I seem to be stuck in a tricky situation...
I have a subform where records can be added or edited. There are two fields: firstname and lastname.
I want a message box to appear when a first or last name is edited.
I do not want that message box to appear when a new name is being added. I use this code:
Private Sub FirstName_AfterUpdate()
If Me.NewRecord = False Then
MsgBox "Message.", vbOKOnly, "Name Change"
End If
End Sub
Now I want to also prevent the user from leaving a record before both fields have data (first and last name are required). My efforts to do this seem to conflict with my message box issues.
Can anyone see what I'm doing wrong or how to do this?
Thank you,
Carly
I have a subform where records can be added or edited. There are two fields: firstname and lastname.
I want a message box to appear when a first or last name is edited.
I do not want that message box to appear when a new name is being added. I use this code:
Private Sub FirstName_AfterUpdate()
If Me.NewRecord = False Then
MsgBox "Message.", vbOKOnly, "Name Change"
End If
End Sub
Now I want to also prevent the user from leaving a record before both fields have data (first and last name are required). My efforts to do this seem to conflict with my message box issues.
Can anyone see what I'm doing wrong or how to do this?
Thank you,
Carly