You have already set up the Form_BeforeUpdate event so that it complains if
a required field is left blank. That means it is impossible to save the form
once an entry has been started unless the required field is filled in.
Setting Dirty to False fires Form_BeforeUpdate if there is any entry in
progress. That takes care of the required field.
The only other scenario is where the user has *not* even started any entry.
This usually means they changed their mind and decided no to make an entry.
The normal process would be to accept that there is no entry at all and
allow them to close the form. If you want to insist that they MUST enter a
record, and they cannot close the form until they do so, you could add a
condition that tests to see if they are still at the new record, and don't
allow the close for that case.
It does not seem like a good idea to me, but the code would look like this:
Private Sub Close_Form_Click()
On Error GoTo Err_Close_Form_Click
If Me.Dirty Then
Me.Dirty = False
End If
If Me.NewRecord Then
MsgBox "You cannot get outa here until you enter something!"
Else
DoCmd.Close acForm, Me.Name
End If
Exit_Close_Form_Click:
Exit Sub
Err_Close_Form_Click:
MsgBox Err.Description
Resume Exit_Close_Form_Click
End Sub
You would need to make the form modal, and turn off its Close button and
Control Box to make this reliable.