G
Gmen via AccessMonster.com
I have a access database with SQL backend. The table labproofs has charges
listed by report date, with the below query, I can run a cross tabquery with
the end date selected from a form (monthly report), and it gives me the 12
month data from the end date selected. However, the problem I face is for
example if the end date selected is feb 28th, I get the data for previous
months as Jan 28, Dec 28, Nov 28 ......, I want data for the month end
numbers like feb 28, Jan 31, Dec 31....., I am not sure what I am doing wrong
here.
Please help.
Gmen
PARAMETERS [Forms]![Monthly Reports]![EndDate] DateTime;
TRANSFORM Sum(LABPROOFS.Charges) AS SumOfCharges
SELECT ClientMasterFile.manager, ClientMasterFile.repname, ClientMasterFile.
ContactID
FROM ClientMasterFile INNER JOIN LABPROOFS ON ClientMasterFile.acctNum =
LABPROOFS.Account
WHERE (((LABPROOFS.Transtype)="4010"))
GROUP BY ClientMasterFile.manager, ClientMasterFile.repname, ClientMasterFile.
ContactID
PIVOT "Mth" & Format(DateDiff("m",[ReportDate],Forms![Monthly Reports]!
EndDate)) In ("Mth0","Mth1","Mth2","Mth3","Mth4","Mth5","Mth6","Mth7","Mth8",
"Mth9","Mth10","Mth11","Mth12");
listed by report date, with the below query, I can run a cross tabquery with
the end date selected from a form (monthly report), and it gives me the 12
month data from the end date selected. However, the problem I face is for
example if the end date selected is feb 28th, I get the data for previous
months as Jan 28, Dec 28, Nov 28 ......, I want data for the month end
numbers like feb 28, Jan 31, Dec 31....., I am not sure what I am doing wrong
here.
Please help.
Gmen
PARAMETERS [Forms]![Monthly Reports]![EndDate] DateTime;
TRANSFORM Sum(LABPROOFS.Charges) AS SumOfCharges
SELECT ClientMasterFile.manager, ClientMasterFile.repname, ClientMasterFile.
ContactID
FROM ClientMasterFile INNER JOIN LABPROOFS ON ClientMasterFile.acctNum =
LABPROOFS.Account
WHERE (((LABPROOFS.Transtype)="4010"))
GROUP BY ClientMasterFile.manager, ClientMasterFile.repname, ClientMasterFile.
ContactID
PIVOT "Mth" & Format(DateDiff("m",[ReportDate],Forms![Monthly Reports]!
EndDate)) In ("Mth0","Mth1","Mth2","Mth3","Mth4","Mth5","Mth6","Mth7","Mth8",
"Mth9","Mth10","Mth11","Mth12");