G
Guest
What I have is a form where a user can input the query criteria (location,
month, programcode). This generates a report which will list representative
and totals for the month(np & rp for new and repeat business). The trouble
is that I am required to break the monthly totals down into weeks.
(totalwk1, totalwk2...totalwk6) The 6th is to cover the event of a single day
in the week since we work on a Mon-Sat week. In any case, I am able to run
seperate queries for each week, based on the criteria entered, and they work
fine except that as soon as these queries are referenced from within the
report, I am prompted for input for eack week query. Any ideas how to work
around this?
Here is the SQL code for the main and weekly queries:
Main Query:
SELECT Format$([refdate],'mmmm') AS [refdate By Month], tbl_actual.officeID,
tbl_actual.repID, tbl_actual.progCodes, Sum(tbl_actual.rp) AS SumOfrp,
Sum(tbl_actual.np) AS SumOfnp
FROM tbl_actual
GROUP BY Format$([refdate],'mmmm'), tbl_actual.officeID, tbl_actual.repID,
tbl_actual.progCodes
HAVING (((Format$([refdate],'mmmm'))=[Forms]![frm_report1_select].[rptdate])
AND ((tbl_actual.officeID)=[Forms]![frm_report1_select].[officeID]) AND
((tbl_actual.progCodes)=[Forms]![frm_report1_select].[progCodes]))
ORDER BY tbl_actual.officeID, tbl_actual.repID, tbl_actual.progCodes;
Week Query:
SELECT weekofmonth([refdate]) AS WoM, tbl_actual.officeID, tbl_actual.repID,
tbl_actual.progCodes, Sum(tbl_actual.rp) AS SumOfrp, Sum(tbl_actual.np) AS
SumOfnp, Format$([refdate],'mmmm') AS [refdate By Month]
FROM tbl_actual
GROUP BY weekofmonth([refdate]), tbl_actual.officeID, tbl_actual.repID,
tbl_actual.progCodes, Format$([refdate],'mmmm')
HAVING (((weekofmonth([refdate]))=1) AND
((tbl_actual.officeID)=[Forms]![frm_report1_select].[officeID]) AND
((tbl_actual.progCodes)=[Forms]![frm_report1_select].[progCodes]) AND
((Format$([refdate],'mmmm'))=[Forms]![frm_report1_select].[rptdate]))
ORDER BY tbl_actual.officeID, tbl_actual.repID, tbl_actual.progCodes;
month, programcode). This generates a report which will list representative
and totals for the month(np & rp for new and repeat business). The trouble
is that I am required to break the monthly totals down into weeks.
(totalwk1, totalwk2...totalwk6) The 6th is to cover the event of a single day
in the week since we work on a Mon-Sat week. In any case, I am able to run
seperate queries for each week, based on the criteria entered, and they work
fine except that as soon as these queries are referenced from within the
report, I am prompted for input for eack week query. Any ideas how to work
around this?
Here is the SQL code for the main and weekly queries:
Main Query:
SELECT Format$([refdate],'mmmm') AS [refdate By Month], tbl_actual.officeID,
tbl_actual.repID, tbl_actual.progCodes, Sum(tbl_actual.rp) AS SumOfrp,
Sum(tbl_actual.np) AS SumOfnp
FROM tbl_actual
GROUP BY Format$([refdate],'mmmm'), tbl_actual.officeID, tbl_actual.repID,
tbl_actual.progCodes
HAVING (((Format$([refdate],'mmmm'))=[Forms]![frm_report1_select].[rptdate])
AND ((tbl_actual.officeID)=[Forms]![frm_report1_select].[officeID]) AND
((tbl_actual.progCodes)=[Forms]![frm_report1_select].[progCodes]))
ORDER BY tbl_actual.officeID, tbl_actual.repID, tbl_actual.progCodes;
Week Query:
SELECT weekofmonth([refdate]) AS WoM, tbl_actual.officeID, tbl_actual.repID,
tbl_actual.progCodes, Sum(tbl_actual.rp) AS SumOfrp, Sum(tbl_actual.np) AS
SumOfnp, Format$([refdate],'mmmm') AS [refdate By Month]
FROM tbl_actual
GROUP BY weekofmonth([refdate]), tbl_actual.officeID, tbl_actual.repID,
tbl_actual.progCodes, Format$([refdate],'mmmm')
HAVING (((weekofmonth([refdate]))=1) AND
((tbl_actual.officeID)=[Forms]![frm_report1_select].[officeID]) AND
((tbl_actual.progCodes)=[Forms]![frm_report1_select].[progCodes]) AND
((Format$([refdate],'mmmm'))=[Forms]![frm_report1_select].[rptdate]))
ORDER BY tbl_actual.officeID, tbl_actual.repID, tbl_actual.progCodes;