Hello, trying to understand what I am doing wrong. I have a DLookup to search the table for duplicate records before update, but it keeps producing an error. Any help would be appreciated.
Private Sub DOB_LostFocus()
If (Not IsNull(DLookup("[LastName]", _
"tbl_Client", "[LastName] ='" _
& Me!LastName & "'"))) Then
If (Not IsNull(DLookup("[FirstName]", _
"tbl_Client", "[FirstName] ='" _
& Me!FirstName & "'"))) Then
If (Not IsNull(DLookup("[DOB]", _
"tbl_Client", "[DOB] ='" _
& Me!DOB & "'"))) Then
Else
MsgBox "Name has already been entered in the database."
Cancel = True
Me.Undo
Dim strDocName As String
strDocName = "rpt_ClientSearch"
DoCmd.OpenReport strDocName, acViewReport
End If
End If
End If
End Sub
Private Sub DOB_LostFocus()
If (Not IsNull(DLookup("[LastName]", _
"tbl_Client", "[LastName] ='" _
& Me!LastName & "'"))) Then
If (Not IsNull(DLookup("[FirstName]", _
"tbl_Client", "[FirstName] ='" _
& Me!FirstName & "'"))) Then
If (Not IsNull(DLookup("[DOB]", _
"tbl_Client", "[DOB] ='" _
& Me!DOB & "'"))) Then
Else
MsgBox "Name has already been entered in the database."
Cancel = True
Me.Undo
Dim strDocName As String
strDocName = "rpt_ClientSearch"
DoCmd.OpenReport strDocName, acViewReport
End If
End If
End If
End Sub