Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

want to close queries after running macro

Status
Not open for further replies.

donnycarr

Programmer
Oct 10, 2001
9
GB
I have set up a macro to run several queries. It runs them and exports to Excel..but leaves them open, you then have to close them all down.

Is there a way that the macros can run the queries without opening them in datasheet view OR close them down after running and exporting them?

Any hints or suggestions would be appreciated,

...Donny
 
It sounds like you're running select queries to do what should be done by action queries. Take a second look at what you're doing and see if you can accomplish what you want by other than select queries. Alternatively you might use VBA as the control structure rather than macros so you can specifically tie the export of the file (and other processes) to the query.

Uncle Jack
 
Thanks,
Problem is, I've never used VBA before and its a bit intimidating when you open it up. I think I'll have to stick to the macros for now.

Cheers.
 

If you use the TransferSpreadsheet action, referencing the queries, they should not be left open. I have macros that export to several spreadheets and don't leave the queries open.

Are you running the OpenQuery action before the TransferSpreadsheet action? If so, this is unnecessary. Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top