Take a query from another DB and output its contents into Excel

Access9001

Registered User.
Local time
Yesterday, 17:56
Joined
Feb 18, 2010
Messages
268
What is the quickest and most effective way to do this?

Say I have a database, a.mdb. It has a query inside of it, MainQuery. I want to be able to take the contents of MainQuery from a.mdb and then export it to Excel format. I also need to not kick off any startup macros/automations that a.mdb may inherently possess if I reference this database.
 
Hi Access9001

I'm not totally clear what you mean but will this help?

Use the Transfer spreadsheet method from Access to move the query results to Excel - using vba.

DoCmd.TransferSpreadsheet acImport, 3, _
"Access_Query","C:\Location_of_Excel_file", True, "Range you want to paste to eg - A1:G12"
 
Say I have a pre-existing Excel file (with desired print formatting/settings), and I just want to port a remote query into that file template and export it somewhere. I need to be able to leverage queries that may be in other databases.
 
Why don't you use Excel VBA to run your 'query' & export the file - I'm not sure how you would bring a query from Access to to an Excel file?
 

Users who are viewing this thread

Back
Top Bottom