psycoperl
Active Member
- Joined
- Oct 23, 2007
- Messages
- 339
- Office Version
- 365
- 2016
- Platform
- Windows
- MacOS
- Web
I am trying to use a form that will launch a report based on the selection made by a user.
I have the following query as the recordsource for the report, and would like to have the user set the Site based on [Forms]![frmReporting].[cboCampus] in the line: HAVING (((qryAllData_ByDateSite.Site)=[Forms]![frmReporting].[cboCampus]))
I would like to do is that if a user picks from the form "All Sites" (which passes a value of '00') have all sites be displayed.
I cannot seem to get this to work, could someone please provide some guidance?
Thanks
I have the following query as the recordsource for the report, and would like to have the user set the Site based on [Forms]![frmReporting].[cboCampus] in the line: HAVING (((qryAllData_ByDateSite.Site)=[Forms]![frmReporting].[cboCampus]))
I would like to do is that if a user picks from the form "All Sites" (which passes a value of '00') have all sites be displayed.
I cannot seem to get this to work, could someone please provide some guidance?
Thanks
Code:
SELECT DISTINCTROW Format$([qryAllData_ByDateSite].[ADate],'mmmm yyyy') AS ADate_Month, CLng(Nz(getfiscalyear([ADate]),0)) AS AYear,
CLng(Nz(getfiscalmonth([ADate]),0)) AS aMonth, qryAllData_ByDateSite.Site, tblSite.siteDesc, tblSite.siteAbrv,
Sum(qryAllData_ByDateSite.SumOfdelivQty) AS delivQty,
Sum(qryAllData_ByDateSite.SumOfreadQty) AS readQty,
Sum(qryAllData_ByDateSite.SumOfpackQty) AS packQty,
Sum(qryAllData_ByDateSite.SumOfpickQty) AS pickQty
FROM tblSite INNER JOIN qryAllData_ByDateSite ON tblSite.siteID = qryAllData_ByDateSite.Site
GROUP BY Format$([qryAllData_ByDateSite].[ADate],'mmmm yyyy'), CLng(Nz(getfiscalyear([ADate]),0)),
CLng(Nz(getfiscalmonth([ADate]),0)), qryAllData_ByDateSite.Site, tblSite.siteDesc, tblSite.siteAbrv,
Year([qryAllData_ByDateSite].[ADate])*12+DatePart('m',[qryAllData_ByDateSite].[ADate])-1
HAVING (((qryAllData_ByDateSite.Site)=[Forms]![frmReporting].[cboCampus]))
ORDER BY CLng(Nz(getfiscalyear([ADate]),0)), CLng(Nz(getfiscalmonth([ADate]),0));