P
psPaul
In my form, I set 3 monthly parameters --
M3 = "Mar 2004" ' 3 months ago
M2 = "Apr 2004" ' 2 months ago
M1 = "May 2004" ' 1 month ago
and then call report
rptGetEachPerson which has source of
qryGetEachPerson which has sql
Select tblMember.ID,
tblMember.Name,
' here I want to call a common query 3 times
qryGetHours(M3).General as G3, 'what can go here
qryGetHours(M2).General as G2, 'to send 3 params
qryGetHours(M1).General as G1 'to qryGetHours?
From tblMember
Left Join
qryGetHours on tblMember.ID = qryGetHours.ID
Group by tblMember.ID;
and where qryGetHours has sql
Select tblHours.ID,
sum(IIF(HoursType="General"),Hours,0) as General
From tblHours
Where (((Format$([Date],'mmm yyyy')) = [&Mx]))
Group by tblHours.ID;
---or do I need to create 3 sub-queries (duplicated code)---
qryGetHoursM3
qryGetHoursM2
qryGetHoursM1
and hardcode the Where parameter names as M3, M2, M1?
????
tkx, Paul
M3 = "Mar 2004" ' 3 months ago
M2 = "Apr 2004" ' 2 months ago
M1 = "May 2004" ' 1 month ago
and then call report
rptGetEachPerson which has source of
qryGetEachPerson which has sql
Select tblMember.ID,
tblMember.Name,
' here I want to call a common query 3 times
qryGetHours(M3).General as G3, 'what can go here
qryGetHours(M2).General as G2, 'to send 3 params
qryGetHours(M1).General as G1 'to qryGetHours?
From tblMember
Left Join
qryGetHours on tblMember.ID = qryGetHours.ID
Group by tblMember.ID;
and where qryGetHours has sql
Select tblHours.ID,
sum(IIF(HoursType="General"),Hours,0) as General
From tblHours
Where (((Format$([Date],'mmm yyyy')) = [&Mx]))
Group by tblHours.ID;
---or do I need to create 3 sub-queries (duplicated code)---
qryGetHoursM3
qryGetHoursM2
qryGetHoursM1
and hardcode the Where parameter names as M3, M2, M1?
????
tkx, Paul