Macro Automation

  • Thread starter Thread starter DaveB
  • Start date Start date
D

DaveB

I have a Macro that runs 2 queries. The second query is a
totals query and runs off the results of the first query.

How do I get the results of the first query into the
second query, so the second query runs correctly?

Thanks.

DaveB
(e-mail address removed)
 
You shouldn't need to do anything: just base the 2nd query on the first one.
 
The second query is an existing query, how do I get the
results of the first query into the second so the data
comes out correct when the macro is run. Thank, I'm
struggling with this. DaveB
 
Let's say you've got a query to get total sales for each employee this month

SELECT EmployeeID, SalesAmount, SalesDate
FROM Sales
WHERE SalesDate BETWEEN DateSerial(Year(Date), Month(Date), 1)
AND DateSerial(Year(Date), Month(Date) + 1, 0)

and you've saved that query as qryEmployeeDetails

To get a summary of total sales per employee, you'd create a second query:

SELECT EmployeeID, Sum(SalesAmount)
FROM qryEmployeeDetails
GROUP BY EmployeeID
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top