Catching error messages

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've got my code to check for required fields when pressing the forms Save
Command button. (IF null----MsgBox: Please select a Name, If Null ---Please
select a date....) How do I get the error messages to appear if the user
Tabs till the end of the record or closes the form using the X button.
 
to stop form closing without certan fields filled in, add event
procedure to Unload event of form

Private Sub Form_Unload(Cancel As Integer)

If IsNull(Me!FieldName) Then
MsgBox "Please fill in this field before closing form"
Cancel = True
End If

End Sub
 
Back
Top