Hello,
I am relatively new visual basic and am struggling with some code and was wondering if anyone else out there can help me.
I am using VB in access 2003 and have a form with several fields on it. There is six fields that are required on the form. I have set a add record button and am using the on click event to make sure these six fields are not null and not zero.
I have it set so that if the routine detects a field that is null or zero in length it flips up a message box. My intent was to stop the rest of the code from processing and the focus to be reset to the field that needed the data entered but when I go to execute it runs fine without error but does not stop the rest of the routine from executing. It’s like I can’t quite grasp one little line that tells the form to stop everything. So that is what I am needing help with. I will post a portion of the code here.
‘Evaluate Section Code Combo Box
If Me.cboSectionCode.Value = “” Or (IsNull(Me.cboSectionCode.Value)) Then
flgSectionCode = False
EnterMsgBox = MsgBox(“Section Code is a required field, please select data and continue.”, vbOKCancel, “Required Field Error”)
If VbMsgBoxResult = 1 Then
Me.cboSectionCode.SetFocus
End If
End If