Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duplicated records 1

Status
Not open for further replies.

damaruk

Technical User
Aug 2, 2000
53
0
0
GB
How do you prevent the duplication of records. ie) adding a customer as a new one but they are already on the database

Thanks
Mark
[sig][/sig]
 
Make the appropriate index unique. In the table design set the indexed property for the Customer Name field to Yes (No Duplicates).
If you have more than one Customer Name field (e.g. First, Middle, Last) then let me know and I'll give further help.
[sig]<p>Keith C Taylor<br><a href=mailto:TekTips@kctaylor.co.uk>TekTips@kctaylor.co.uk</a><br><a href= Information Gardener</a><br>The C stands for Computer![/sig]
 
Thanks for your help Keith
[sig][/sig]
 
If you get an error message about duplicated records preventing you from saving your table changes then create a new query using the Find Duplicates wizard. This will display records that have been duplicated so that you can delete them or edit the name to be unique.
[sig]<p>Keith C Taylor<br><a href=mailto:TekTips@kctaylor.co.uk>TekTips@kctaylor.co.uk</a><br><a href= Information Gardener</a><br>The C stands for Computer![/sig]
 
I have ran the duplication wizard as you suggested. The duplications in name are justified as the name is the same for different offices. You said that if I needed to prevent more than 1 field to get back to you and you would tell me what to do. I feel to prevent ligitimate duplication I possible need to prevent duplication in 3 fields.

Hope you can help
mark (damaruk) [sig][/sig]
 
The easy way, in table design, is to Ctrl-Click the selector at the left of each field name, so that the 3 fields you are interested in are highlighted, then click the Primary Key button on the toolbar. This will create a new index, that will ensure uniqueness across the 3 selected fields.

If you already have a Primary Key index that you don't want to lose, then Click the Indexes button (or menu - View Indexes). Type an index name in the left hand column, e.g. Customer then, in the Field Name column, select the field names in this row and the next two rows so that you have a list of the 3 fields you need to index. Move back to the index name (Customer) and make sure the Unique property is set to Yes. Save the table, and if you now try to enter duplicate records wou will get an error message and the record will not be saved.

Note that you should really check for duplicates across the 3 fields you have selected before trying to change the table design, otherwise, as before, Access will not let you change the table if existing records flout your new rules.
[sig]<p>Keith C Taylor<br><a href=mailto:TekTips@kctaylor.co.uk>TekTips@kctaylor.co.uk</a><br><a href= Information Gardener</a><br>The C stands for Computer![/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top