Solved

edit query in VBA

Posted on 2011-03-24
3
608 Views
Last Modified: 2012-06-27
I have a query that I set up that I need to edit from VBA to specify criteria in two fields.  The results I then need to output directly to an excel spreadsheet.   I need to loop through a list of values to use for the search criteria and append the new results to the Excel sheet so that I have one sheet for all criteria values that were used in the query.  What is the best way to do this?
0
Comment
Question by:janderscu
3 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 250 total points
ID: 35208183
Sounds like you should be building a table to hold the pairs of values for the selection.  You can then use a simple join from that table to the main table on these two fields, to select all the required records in one execution of the query.
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 35210605
I agree with Peter.  Otherwise, you will have to automate Excel to start your output in a particular row of a particular spreadsheet.
0
 

Author Closing Comment

by:janderscu
ID: 35214689
Sounds good.  Seems easy enough.
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now