Macro Automation

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
[email protected]
 
D

Douglas J. Steele

You shouldn't need to do anything: just base the 2nd query on the first one.
 
D

DaveB

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
 
D

Douglas J. Steele

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
 
Top