G
Guest
hello
i have a form that is called from a switchboard in "add" mode
I have three controls on this form LastName, FirstName and ID which are
bound to the FirstName, LastName, and ID feilds in the IDTable table. What I
am trying to do is compare data on the form to existing data in the table to
check for dupilcate entries and prompt the user for confirmation. I have the
following code in place and cannot see the problem with it. Of course the
wrapping of the message wreaks havoc with the " _ " character.
please advise
************************************************************
Private Sub FirstName_AfterUpdate()
If Not IsNull(DLookup("[FirstName]", "IDTable", "FirstName ='" _
& Me.FirstName & "' AND [LastName] = '" & Me.LastName & "'")) Then
If MsgBox("A Record For" & " " & [FirstName] & " " & [LastName] & " " &
"already exists. Do you want to continue ?", _
vbYesNo, "Record Exists") = vbNo Then
Me.Undo
End If
End If
End Sub
i have a form that is called from a switchboard in "add" mode
I have three controls on this form LastName, FirstName and ID which are
bound to the FirstName, LastName, and ID feilds in the IDTable table. What I
am trying to do is compare data on the form to existing data in the table to
check for dupilcate entries and prompt the user for confirmation. I have the
following code in place and cannot see the problem with it. Of course the
wrapping of the message wreaks havoc with the " _ " character.
please advise
************************************************************
Private Sub FirstName_AfterUpdate()
If Not IsNull(DLookup("[FirstName]", "IDTable", "FirstName ='" _
& Me.FirstName & "' AND [LastName] = '" & Me.LastName & "'")) Then
If MsgBox("A Record For" & " " & [FirstName] & " " & [LastName] & " " &
"already exists. Do you want to continue ?", _
vbYesNo, "Record Exists") = vbNo Then
Me.Undo
End If
End If
End Sub