I have a database(Access 2010) with about 6 tables related to 1 master table, and I would like to duplicate a record from the master table, and take with it the related tables from the other tables. Is there a simpler way to do this than my current method which involves:
-
Find the next master ID number
-
insert the old record with the new ID into the master table.
-
Use the new ID number to insert into each of the related tables.
I am currently using VBA to find the new ID and run the SQL. I would prefer to run this a 1 SQL query, and I am running this from a button press, so VBA is not out of the question.
Thanks for any help.
No, that sounds about how you have to do it, as near as I know.
Attempting to
UPDATEwould of course not leave any behind…Your current solution (using VBA) is honestly probably your best bet; sure, you could use another language, or wrap it in a stored procedure, but you’re still stuck with these exact steps. It’s pretty much a feature of the language (SQL) and systems (RDBMSs in general) design.