|
Question : Dlookup to prevent duplicate entries
|
|
I have the following code in place to check for duplicate entry in [Certificate Number]. Each time I test it with duplicate date I get an error message telling me I cancelled the previous operation. I'm sure I've messed up the syntax for the dLookup function. Can anyone help?
Thanks!
Rose Marie
---------------------------Begin code--------------------
Private Sub Contract_Number_BeforeUpdate(Cancel As Integer)
If DLookup("[Certificate Number]", "tblAFRateMovement", "[Certificate Number] = '" & Me.txtContractNumber & "'") Then
Me.Undo
MsgBox "Warning! Certificate Number " _ & txtContractNumber & " has already been entered." _ & vbCr & vbCr & "Please try again.", vbExclamation, "Duplicate Certificate Number!"
End If
End Sub -------------------------End code----------------------------------------
|
|
Answer : Dlookup to prevent duplicate entries
|
|
PAQed with points refunded (125)
Computer101 EE Admin
|
|
|
|