You can set the Close Button property to No in the properties dialog for the
form. This isn't necessary. You can still force the checking of the field
when the user uses the Close button.
You use the form's Unload event to do your validation because it can be
canceled and the form will not close until it passes your validation:
Private Sub Form_Unload(Cancel As Integer)
If Not validated Then
MsgBox "Validation Failed"
Cancel = True
End If
End Sub
This is only an example. You would replace "Not validated" with the code to
validate your fields. If this code exists in another procedure in your code,
you can call that procedure to do the validation. For example, let's say
your validation is in the Before Update event of the form. Move the
validation code out of the event into a function that will return either True
or False. Then call that function from both events.