I have a field1 and field2 that together make a unique key. First, how can I
set them up as a combined key. Second, how can I code an SQL to eliminate
duplicate rows.
You won't be able to create a unique key in a table which has
duplicates. I'd suggest that you copy and paste the existing table,
*design mode only*, to a new table. You can then create the unique
index in this new (empty) table. To do so click the Indexes icon
(which looks like lightning hitting a datasheet); type a name for the
index in the left column and select the two fields, one on the same
line and one on the next, in the right-hand column. Specify that this
index is unique using the checkbox.
Then run an Append query from your existing table into this new one.
One arbitrary record of each set of duplicates will be added; you'll
get a warning message that "xxx records were not added due to indexing
violations" or the like. These are the duplicates which are being
discarded.
John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps