Amber
Amber

Reputation: 1

Access - retrieve data from another query

I've got query called Date which has two parameters: Date, IfEndDate and NumberOfMonths and IfEndDate is true it counts [NumberOfMonths] months before entered date as StartDate, and entered date names as EndDate, and IfEndDate is false it counts [NumberOfMonths] months after entered date etc.

And I've got some queries which counts many other things, eg. how many deals do employees between entered days or how many customers bought chairs between these days.

Is there any option to enter Date, IfEndDate and NumberOfMonths in eg. 'How many deals' query and it'll retrieve StartDate and EndDate from Dates query?

Upvotes: 0

Views: 163

Answers (1)

chip
chip

Reputation: 2270

I'm not sure if I understand you completely, but it sounds like you want to use a stored query as part of another query.

If you are using the graphical QBE to create your queries, you can add a query to the QBE canvas and treat it like a table.

For a trivial case this could look like::

SELECT myDatesQuery.StartDate, myDatesQuery.EndDate 
FROM   myDatesQuery
WHERE  myDatesQuery.NumberOfMonths < 3

Upvotes: 1

Related Questions