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)
 
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
 
Back
Top