Solved

edit query in VBA

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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 …

920 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

15 Experts available now in Live!

Get 1:1 Help Now