John Sheehy
asked on
Overwriting Duplicate SQL Data
I have an SQL statement that I am trying to run. How the whole thing works is I import a table into my existing database. The linked table is ARB1 and the one in the database is ARB. The following is the SQL statement I have in my code to import data from ARB1 into ARB.
I get the error duplicate data. How do I delete the duplicate data or delete the data first and then import the data?
DoCmd.RunSQL "INSERT INTO tblARB ( [Personnel ID Code] )SELECT tblStudent1.[Personnel ID Code], tblARB1.* FROM tblStudent1 LEFT JOIN tblARB1 ON tblStudent1.[Personnel ID Code] = tblARB1.[Personnel ID Code] WHERE (((tblStudent1.Instructor) Like [Who is the Instructor]));"
Thanks
JS
I get the error duplicate data. How do I delete the duplicate data or delete the data first and then import the data?
DoCmd.RunSQL "INSERT INTO tblARB ( [Personnel ID Code] )SELECT tblStudent1.[Personnel ID Code], tblARB1.* FROM tblStudent1 LEFT JOIN tblARB1 ON tblStudent1.[Personnel ID Code] = tblARB1.[Personnel ID Code] WHERE (((tblStudent1.Instructor)
Thanks
JS
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
jrb is correct - run the above sql - then run your pre-existing sql statement for the inserts; this will remove the duplicates; then your insert will put everything in.
ASKER
I get the following error:
Duplicate Output destination 'Personnel ID Code'.
I have the link of personnel ID Code in both tables. Is there a way around this?
JS
Duplicate Output destination 'Personnel ID Code'.
I have the link of personnel ID Code in both tables. Is there a way around this?
JS
ASKER
Up'd the points
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Now that worked out great. I am upping the points to 500 and split accordingly.
JS
JS