prevent duplicates in table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 2 tables, tblclients and tblappointments related in a 1:many based on
cliendID (not an autonumber). I am importing data from a text file to
populate tblappointments (including clientID -foreign Key- and "date of
appointment"). I will by necessity have duplicates in the clientID field
(each client will have more than one appointment) and I will have duplicates
in the "date of appointment field" (more than one client seen per day). I
would like to prevent duplicates in such a way that one client won't be
listed more than once for a given "date of appointment" during the import. Is
this possible? Thanks.
 
create a unique (but not primary) index in your table, made up of both the
clientID and appointment date fields.

open the table in design view, and click on the Indexes button on the
toolbar. there may be other indexes already listed, there certainly will be
if you have a primary field in the table. go to the first blank line in the
Index Name column and enter a name, like ClientAppt. in the next column
FieldName, add the clientID field from the droplist; then go down to the
Index Properties section and change Unique to Yes.
go back up to the Field Name column, and in the next row of the FieldName
column, add the appointment date field (do NOT add an index name in this
row).

when you import the data, records with duplicate combinations of those two
fields should automatically be excluded.

hth
 
Back
Top