Importing/migrating a Query from a cloned database

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Importing/migrating a Query from a cloned database

Post by ChrisGreaves »

Access2003. My main VBA project (Mike.doc) uses Mike.MDB. The database contains several tables.
A new part of the project was created by cloning a copy of Mike.MDB to Trial.MDB and developing VBA code in a new, smaller Word/VBA project Trial.doc in isolation.
The new code works, and makes use of a query table.
I have dragged my Word/VBA code from Trial.doc to Mike.doc and it compiles cleanly.
I have export/imported an updated version of a specific table from Trial.MDB to Mike.MDB.
I wanted to, somehow, drag the query definition from Trial.MDB to Mike.MDB, but could not see a way to do this at the Access2003 database level.

I bit the bullet and just recreated the query from scratch, so I am on track again.

The question remains: How would your average non-VBA/SQL Access user go about migrating one or more queries from a clone of a database into the original database?
This thread https://social.msdn.microsoft.com/Forum ... -using-vba offers VBA/SQL solutions, butas far as i can see, nothing in the way of a drag-and-drop solution for a novice Access users, such as I.

To preempt Hans's question ("Are you willing to execute a SQL string from VBA? Regards, Hans" my answer would be yes, but VBA seems to me like overkill for my one-time copy-this-query operation.
Thanks
Chris
An expensive day out: Wallet and Grimace

User avatar
HansV
Administrator
Posts: 78233
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Importing/migrating a Query from a cloned database

Post by HansV »

In the target database:
Select File > Get External Data > Import...
Browse to the source database, then click Import.
In the Import Objects dialog, activate the Queries tab.
Select the queries that you want to transfer, then click OK.
Best wishes,
Hans

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Importing/migrating a Query from a cloned database

Post by ChrisGreaves »

HansV wrote:
22 Nov 2021, 13:26
... Browse to the source database, then click Import ...
Thank you, Hans.
My level of competence in Access is still at the level of export/import via Excel, which means that an exported query is imported as a table!

I went back to Trial.MDB and created a new query, then went to Mike.MDB and successfully imported the new query as a query. :clapping:
Thanks again
Chris
An expensive day out: Wallet and Grimace