No duplicate entries

slyvsspy

Registered User.
Local time
Today, 09:51
Joined
Jun 24, 2002
Messages
51
If I have someone entering in a bunch of entries through a form, how could I not allow them to enter duplicate records based on the first name and the last.

Thanks,
 
Here's what I do in the form's BeforeUpdate event:

(ID is an Autonumber primary key of my People table)

If Nz(Dlookup("ID","tblPeople","FirstName = '" & Me.tbxFirstName _
& "' AND LastName = '" & Me.tbxLastName & "'"),0) = 0 then
MsgBox "Cannot save record with duplicate name",,"Save Cancelled"
Cancel = -1
Exit Sub
End If

HTH,
Jim
 

Users who are viewing this thread

Back
Top Bottom