Message if not all essential fields completed

B

Baz

Hi
I want to to stop a form from closing and display a
message to let the operator know that an essential field
on the form has not being completed. any ideas please?
 
A

Allen Browne

If you want to insist that a record cannot be saved unless a particular
field has been filled in:
1. Open your table in design view.
2. Select the field that must be filled in.
3. In the lower pane, set its Required property to Yes.

You can also check for it in the BeforeUpdate event procedure of the form if
you prefer:

Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.SomeField) Then
Cancel = True
MsgBox "SomeField must be filled in."
End If
End Sub
 
Top