Appending multiple records to multiple tables (1 Viewer)

Gmelsofty

Registered User.
Local time
Yesterday, 23:59
Joined
Mar 26, 2017
Messages
20
Hello...
I would wish to append multiple records from one table or query to multiple tables like 4 tables or so ONCE using VBA when a command button is clicked.
Furthermore, during the process, only new records are added while the existing records are updated
How can I go about with this.
Regards.
 

Frothingslosh

Premier Pale Stale Ale
Local time
Today, 02:59
Joined
Oct 17, 2012
Messages
3,276
I suppose the first question you should answer is why you have one table or query leading to new records in four different tables.

Things like that are typically a gigantic red flag for a mis-designed database.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 07:59
Joined
Feb 19, 2013
Messages
16,663
you will need 8 queries, 2 for each table, 1 each for append and update.

You can run these queries one after the other in code or macro on the command button click event

the append query will need to have a left join between your import table and the target table to identify those records in the import table which are not in the target table.

the update query will need an ordinary join between the import and target tables. You probably don't need to identify which records have changed - unchanged records will just be updated with the same data.
 

Users who are viewing this thread

Top Bottom