E
Eric
I have recently adopted a database that tracks users and I need to prevent
duplicates from being entered into a form. I have tried using previous
threads, but I can't get them to work. I am aware of the ability to prevent
duplicates through the table, but the error message it gives would be quite
confusing to the users of this database. The name of the table I have is
"Names", the form is called "Names", and the field is "FullName". The
FullName field is invisible to the user and is a combination of the fields
"FirstName" and "LastName" using the after update event on the "FirstName"
field. I have been trying to use the Before Update event on the "FirstName"
field, but I can't get it to work. This is what I got so far:
Private Sub FirstName_BeforeUpdate(Cancel As Integer)
If Not IsNull(DLookup("FullName", "Names", "FullName = '" & Forms!Names!
FullName & "'")) Then
Cancel =True
MsgBox "..."
End If
End Sub
Can someone assist?
duplicates from being entered into a form. I have tried using previous
threads, but I can't get them to work. I am aware of the ability to prevent
duplicates through the table, but the error message it gives would be quite
confusing to the users of this database. The name of the table I have is
"Names", the form is called "Names", and the field is "FullName". The
FullName field is invisible to the user and is a combination of the fields
"FirstName" and "LastName" using the after update event on the "FirstName"
field. I have been trying to use the Before Update event on the "FirstName"
field, but I can't get it to work. This is what I got so far:
Private Sub FirstName_BeforeUpdate(Cancel As Integer)
If Not IsNull(DLookup("FullName", "Names", "FullName = '" & Forms!Names!
FullName & "'")) Then
Cancel =True
MsgBox "..."
End If
End Sub
Can someone assist?