By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,497 Members | 2,113 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,497 IT Pros & Developers. It's quick & easy.

Running pre-defined queries and save the result in an excel file

P: 1
Hello,

As part of an application that I am trying to create thru MS Access, the user enters few parameters and based on that I would like the result of some predefined queries to be saved in an excel file (in separate worksheets). I have created a table which lists the name of queries in one field and user's parameters in a separate fields. When I select a command button, I like the queries run one at the time (go thru each record find the query in the table) and the results are saved in an excel file. For example, in the table below if teh user enters 1 and A, then Query-A-1 and Query-A-2 should be run and their records be saved in one excel file. I can do this by creating multple IF - statements. However, I would like to know if it is possible to do this in a differnt way (i.e one loop)

User Data 1 User Data 2 Queries
1 A Query-A-1
1 A Query-A-2
2 B Query-B-1
2 B Query-B-2

Thank you in advance.
May 4 '10 #1
Share this Question
Share on Google+
2 Replies


Jim Doherty
Expert 100+
P: 897
@mborhanian
Yes you can loop through records in either a table or query according to preset logic and using 'Office' automation, save the results to an excel file.

Yes this can be done where it is on separate sheets again using automation techniques

What is your approach to this, what have you coded yourself to make this work?

If you show something done yourself I am sure others will be happy to contribute rather than just give a solution to this
May 10 '10 #2

NeoPa
Expert Mod 15k+
P: 31,186
Application Automation would be a good starting point for your work.
May 11 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.