Solved

edit query in VBA

Posted on 2011-03-24
3
613 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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…

756 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