Hi,
I would like to check that the surname and the DOB field has been populated before saving the record. I am not to sure where to put the code. I did try the form Before update event this did not work. All I would like is a message to advise the user they have not put data in these pretty important fields and give them option to say OK save the record otherwise cancel and go back into the record on the form.
I have got this far so far. Cheers Rachel.
Private Sub Surname_BeforeUpdate(Cancel As Integer)
On Error GoTo ErrorHandler
If Me.Surname = "" Then
MsgBox "You have not entered a surname are you sure you want to go ahead and save this record", vbYesNoCancel, "Missing Surname"
Cancel = True
ElseIf Me.Surname <> "" Then
Cancel = False
End If
Exit Sub
ErrorHandler:
HandleError
Exit Sub
End Sub
I would like to check that the surname and the DOB field has been populated before saving the record. I am not to sure where to put the code. I did try the form Before update event this did not work. All I would like is a message to advise the user they have not put data in these pretty important fields and give them option to say OK save the record otherwise cancel and go back into the record on the form.
I have got this far so far. Cheers Rachel.
Private Sub Surname_BeforeUpdate(Cancel As Integer)
On Error GoTo ErrorHandler
If Me.Surname = "" Then
MsgBox "You have not entered a surname are you sure you want to go ahead and save this record", vbYesNoCancel, "Missing Surname"
Cancel = True
ElseIf Me.Surname <> "" Then
Cancel = False
End If
Exit Sub
ErrorHandler:
HandleError
Exit Sub
End Sub