Hi,
I am doing validations for my form in the "Before_Update" event. This event is triggered when command button 'cmdave' is pressed.
In Before_Update, for each control, I have validation code. If a required field is missing, I display an error with msgbox, and exit the sub. However, the problem is, processing goes to the 'end sub' of cmdSave, rather than the 'end sub' of the current event, Before_Update. Do I need to 'shut off' the Access message informing me that the Save was cancelled? (and how is that done?)
My code is:
After my msgbox pops up, I then get a second msgbox saying "the DoMenuItem action was cancelled".
thanks in advance...
I am doing validations for my form in the "Before_Update" event. This event is triggered when command button 'cmdave' is pressed.
In Before_Update, for each control, I have validation code. If a required field is missing, I display an error with msgbox, and exit the sub. However, the problem is, processing goes to the 'end sub' of cmdSave, rather than the 'end sub' of the current event, Before_Update. Do I need to 'shut off' the Access message informing me that the Save was cancelled? (and how is that done?)
My code is:
Code:
If DepartmentID = "" Or IsNull(DepartmentID) Then
MsgBox "Please select Department from list.", vbOKOnly
Cancel = True
Exit Sub
End If
After my msgbox pops up, I then get a second msgbox saying "the DoMenuItem action was cancelled".
thanks in advance...