Delete records from main table that appear in an Error Table (1 Viewer)

Gazzateer

New member
Local time
Today, 06:43
Joined
Jan 15, 2020
Messages
4
Hello all, this is my first post, so thank you for your help in advance.

We use an on-line survey to ask our students to let us know any new medical details they have. I download and convert to excel, and import in to a table called “Current Medical Details”. If a record already exists, the database automatically produces a “Paste Errors” table.

What I would like to do, is delete the records from the current Medical Details table using the records from the Paste Errors table, so that I can re-import the most up to date information.

The two unique fields are “F1” in Paste Errors and “1 Student number:” in Current Medical Details.

Thank you.
 

isladogs

MVP / VIP
Local time
Today, 07:43
Joined
Jan 14, 2017
Messages
18,207
This can happen when the datatype used for one or more fields is wrongly interpreted by Access

Instead of pasting the spreadsheet, I would suggest linking to the Excel file then running an append query to import the data into your Access table. This will allow you to control the process
 
Last edited:

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 01:43
Joined
Feb 28, 2001
Messages
27,122
Not only is Colin's suggestion likely to be good, but it has the added feature that if you even temporarily link to that table, you can run a query against it to identify and remove the records you say you want to replace.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:43
Joined
Oct 29, 2018
Messages
21,447
Hello all, this is my first post, so thank you for your help in advance.
Hi. Welcome to AWF!



We use an on-line survey to ask our students to let us know any new medical details they have. I download and convert to excel, and import in to a table called “Current Medical Details”. If a record already exists, the database automatically produces a “Paste Errors” table.
Another approach to handle this situation is to import the Excel converted data into a "staging" table in Access, so you can compare its contents against what's already in "Current Medical Details" table. You can then clean up the main or staging table first before actually adding the new data permanently.


Just a thought...
 

Gazzateer

New member
Local time
Today, 06:43
Joined
Jan 15, 2020
Messages
4
@isladogs, thank you for your suggestion, however for what ever reason, our database will not accept an append import of data which is why i have been using it this way.

i have paid meticulous attention to making sure the cell types are equal in access and excel, but still it won't work.

i should also point out, that each student has a unique number, which does not allow for duplicate records, which is why the error table is produced in the first place.

Thanks @theDBguy
 
Last edited:

isladogs

MVP / VIP
Local time
Today, 07:43
Joined
Jan 14, 2017
Messages
18,207
The only things that would prevent an append query working are
1. Your database is read only which isn't the case as you can paste
2. The append query is badly designed

As DBG mentioned, the best solution is to
1. Link to your Excel file
2. Import to a staging or buffer table
3. Process the data if necessary then append to the final table and update any existing records if necessary.

I have an extended article on synchronising data on my website that may be useful to you http://www.mendipdatasystems.co.uk/improve-security-2/4594571073
 

Users who are viewing this thread

Top Bottom