Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 6th, 2004, 09:59 AM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default prevent duplicate customers when importing data

I have a customer table, tblCustomer. I get updated additional customers from the web in an Excel spread sheet. When new customers are added it is included with the previous customers so I need a way to prevent customers already in the database from being added since I would result in duplicate customers.

When I import these new customers how can I prevent adding customers that are already in the database?

Thanks
 
Old August 6th, 2004, 10:31 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Don't import your data directly into tblCustomer. Import it into a temp table that has the same structure as tblCustomer. Make sure that in tblCustomer that Customer ID is a unique primary key.

After you import the data into a temp table, then use an append query to append the new data from the temp to tblCustomer. Because the Customer ID is a primary key set to INDEXED - NO DUPLICATES, Access will reject the duplicates based on Customer ID.

If your spreadsheet doesn't have Customer ID, then you'll have to create a unique key based on a combination of Last Name + First Name + Address or something like that.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division




Similar Threads
Thread Thread Starter Forum Replies Last Post
Prevent displaying duplicate infromation in xsl Indy1304 XSLT 1 July 28th, 2008 11:13 AM
customers table missing harvtim BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 September 25th, 2007 03:17 AM
Prevent sensitive data to be written on HDD narkobaron Visual C++ 0 April 12th, 2007 10:35 AM
SSIS: Use filename as data when importing data slesicki SQL Server 2005 0 August 7th, 2006 05:00 PM
Trying to upgrade customers' database jeffcflam Pro VB 6 2 June 15th, 2005 01:49 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.