Hi All,
I can't seem to get this Dlookup function to work.
Basically, I have table: "Registry", the field within the table I want to lookup is "Reference". The form is called "AddToRegistry" and the text inputted in the textbox "Reference" I want to check it against the field within the table for duplicates before saving. I had it working at one point but not anymore.
Any ideas.
Thanks in advanced.
Dim Answer As Variant
Answer = DLookup("[Reference]", "Registry", "[Reference] =" & Forms![AddToRegistry]!Reference)
If Not IsNull(Answer) Then
MsgBox "Reference Number Already Exists!" & vbCrLf & "Check the Number and Try Again.", vbCritical + vbOKOnly + vbDefaultButton1, "Duplicate"
Cancel = True
Me.Reference.Undo
Else:
End If
End Sub