Using data in a table for criteria in query

new_2_prog

Registered User.
Local time
Today, 12:56
Joined
Aug 4, 2008
Messages
58
Ok, guess I am having a brain fart of the day.

I created a table that determines the current monday of the week and then 12 mondays ago to be put in table "export_Thruput_Dates" with columns enddate, begindate respectively.

Then I need to run a query "qry_summary" that takes data from table "tbl_Master" but I only want the data between the dates in the "export_Thruput_Dates".

qry_summary:

SELECT tbl_Master.Dept, tbl_Master.MondayDate, Count(tbl_Master.Shift) AS ShiftsWorked, Sum(tbl_Master.cntMachine) AS SumOfcntMachine
FROM tbl_Master
GROUP BY tbl_Master.Dept, tbl_Master.MondayDate
HAVING (((tbl_Master.Dept)="x") AND ((tbl_Master.MondayDate) Between [tables]![export_Thruput_Dates]![BeginDate] And [tables]![export_Thruput_Dates]![EndDate]))
ORDER BY tbl_Master.Dept, tbl_Master.MondayDate;

I run the query and I get input boxes to put dates in for enddate and begindate - why isn't it using the dates in the table?

Thanks!
 
You can't reference a table like that. But you can reference controls (like a textbox) in a form using that syntax, i.e. [Forms]![FormName]![TextboxName]
 
I used this in the criteria box:
Between DMax('[beginDate]','export_thruput_dates') And DMax('[endDate]','export_thruput_dates')
And it worked.
:D
Thanks.
 

Users who are viewing this thread

Back
Top Bottom