Trying to prevent duplicate entries

  • Thread starter Thread starter ChuckW
  • Start date Start date
C

ChuckW

Hi,

I have a table of people and their contact information.
There is an autonumber field that exists since there is a
form for adding people to the table. There is a field
for First Name and a field for last name along with
Address, City, State, Zip, Phone and e-mail. I would
like to somehow prevent duplicate names from being added
to the database but since my first and last names are in
separate fields I am not sure how to do this. There are
often couples in the database with the same phone number
so that won't work and e-mail is often blank. Is there a
way to prevent duplicates from being added to the
database given my situation? I can change the fields if
I need to but there are advantages of having first and
last name in separate fields.

Thanks,

Chuck
 
You might create a unique index on the combination of last name and first
name. See the "Prevent duplicate values from being entered in a combination
of fields" topic in the help for instructions.
 
I am not sure how you are updating your table.
one way i do it is to create a record set using all the
field in the form as criteria. If i get a record then the
record in already there. if i don't get a record i know
the the record is new so
if rs.eof then
add record
else
msgbox(dup record)
clearform
end if
I use unbound forms.
flaw to this. what if one of the people change there e-
mail service. opps. the record set would not get a match
and the record would be added.
 
Back
Top