Hello,
I have seen similar posts to this but nothing exact.
Basically, I would like a message to come up on the BeforeUpdate of the field [DateOfBirth] but both fields [Surname] and [DateOfBirth] need to be used to identify a duplicate. i.e. the message should come up if there is the same date of birth for someone with the same surname.
I have got the following code but it doesn't work...
As you can probably guess I am not that good at coding and have hijacked some similar code from thread702-1361603.
Thank you for any help.
Dave
I have seen similar posts to this but nothing exact.
Basically, I would like a message to come up on the BeforeUpdate of the field [DateOfBirth] but both fields [Surname] and [DateOfBirth] need to be used to identify a duplicate. i.e. the message should come up if there is the same date of birth for someone with the same surname.
I have got the following code but it doesn't work...
Code:
Private Sub DateOfBirth_BeforeUpdate(Cancel As Integer)
Dim strSurnameAndBirthdate As String
strSurnameAndBirthdate = Nz(DLookup("SurnameDateOfBirth", qrySecSurnameDateOfBirth, "SurnameDateOfBirth = """ & Me.Surname & """ & """ & Me.DateOfBirth & """"), "")
If Len(strName) > 0 Then
MsgBox "Already Exists"
Cancel = True
End If
End Sub
As you can probably guess I am not that good at coding and have hijacked some similar code from thread702-1361603.
Thank you for any help.
Dave