Append query to delete Duplicates

jeffandtamara

New Member
Joined
Apr 27, 2009
Messages
18
I have a series of quiers to 1st delete the table then append to the table. I have key field set up to delete duplicate Invoices and dates. What usually happens is the invocie is closed multiple times with no changes, so my process works OK. But sometimes what happens is changes are made and whenthe append occurs, I retain the latest data, and not the updated data. Is there a way to force the append qurey to get the latest data and delete the older data? The date will be the same on both raw data records....
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
I'm having difficulty with your post.

A DELETE query deletes records, not the table.
An APPEND query appends records to a table.

An UPDATE query modifies fields within records in a table.

You should BACKUP your database before doing any of the deletes/appends/updates.

Can you give specific examples with data of what exactly you are doing?
 
Upvote 0
How can you delete a table then append records to a table you've just deleted?

Why do you even want to delete any of the data?

Surely with something like invoice data you would want to keep it?

Also, if data is going to change wouldn't it be an idea to keep the original data so you can refer back to it in the future?
 
Upvote 0
The data comes in via text files that are generated when a transaction happens. The delete query runs when a report is generated, then the the text file is appended to the empty table. The key fields keep duplicate data from being appended into the database.
The problem is when there is duplicates, the first record is kept, not the latest. Is there a way I could sort the data so that the latest data gets appended first, then the problem would be solved, I think?
 
Upvote 0

Forum statistics

Threads
1,224,506
Messages
6,179,159
Members
452,892
Latest member
yadavagiri

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top