Message Box on form close

123dstreet

Registered User.
Local time
Yesterday, 20:20
Joined
Apr 14, 2010
Messages
122
Hi All!

I have created a code to say that when a certain combo box is left blank, and the user goes to close the form, a msgbox pops up saying, "fill in this information" :

Private Sub Form_AfterUpdate()
If Combo223 = "Inventory Removal" And Combo316.Visible = True And Combo316 = IsNull Then
MsgBox "Enter Inventory Removal Info", vbOKOnly, "Inventory Removal Info,"
End If
End Sub

The only problem is that I do NOT want the form to close after that message box has been clicked "OK", so that the user can go back and enter that required information.. ANY IDEAS??

Thanks !!!
 
You have to use the form's BEFORE UPDATE event, not the After Update event. If your validation fails you add a

Cancel = True

and it will keep the update from happening and the form from closing.
 

Users who are viewing this thread

Back
Top Bottom