You can use Where in your totals query and not have it affect your grouping.
Uncheck the Show box in your query.

Signature
Duane Hookom
MS Access MVP
--
Thanks for the help. I'll post back when I get it working.
I have set my query to the following SQL:
SELECT tblClients.intClientID, tblClients.strName,
Sum(tblCommissions.curAmount) AS SumOfcurAmount
FROM tblClients LEFT JOIN tblCommissions ON tblClients.intClientID =
tblCommissions.intClientID
WHERE (((tblCommissions.datPeriod)<>0))
GROUP BY tblClients.intClientID, tblClients.strName
ORDER BY Sum(tblCommissions.curAmount) DESC;
When I run the report with this command:
strWhereCond = "([datPeriod]=#11/01/2005#)"
DoCmd.OpenReport stDocName, ViewMode, , strWhereCond
I get the "Enter Parameter Value" input box asking me what datPeriod
is.
I'm assuming this is happening because datPeriod is not in the SELECT
portion of the SQL statement. However, if I put it in the SELECT
portion of the statement, I have to put it in the GROUP BY portion of
the statement, and I don't want to do that.
Is there any way around that?
Duane Hookom - 08 Dec 2005 18:16 GMT
You need set the criteria in the query using a reference to a control on a
form or a parameter prompt.
SELECT tblClients.intClientID, tblClients.strName,
Sum(tblCommissions.curAmount) AS SumOfcurAmount
FROM tblClients LEFT JOIN tblCommissions ON tblClients.intClientID =
tblCommissions.intClientID
WHERE tblCommissions.datPeriod = Forms!frmYourForm!cboDatPeriod
GROUP BY tblClients.intClientID, tblClients.strName
ORDER BY Sum(tblCommissions.curAmount) DESC;

Signature
Duane Hookom
MS Access MVP
--
>I have set my query to the following SQL:
>
[quoted text clipped - 19 lines]
>
> Is there any way around that?
Patrick - 08 Dec 2005 18:26 GMT
Ok, I figured I could do that but it would be easier if I could do it
with the OpenReport statement. Oh well. Thanks for the help, Duane.
Have a great day!
Patrick - 08 Dec 2005 19:32 GMT
Just to let you know, since I wanted to do a date range I had to have a
txtPeriodStart and txtPeriodEnd on my form. My final SQL statement
was:
PARAMETERS [Forms]![frmPrintReports]![txtPeriodStart] DateTime,
[Forms]![frmPrintReports]![txtPeriodEnd] DateTime;
SELECT tblClients.intClientID, tblClients.strName,
Sum(tblCommissions.curAmount) AS SumOfcurAmount
FROM tblClients LEFT JOIN tblCommissions ON tblClients.intClientID =
tblCommissions.intClientID
WHERE (((tblCommissions.datPeriod) Between
[Forms]![frmPrintReports]![txtPeriodStart] And
[Forms]![frmPrintReports]![txtPeriodEnd]))
GROUP BY tblClients.intClientID, tblClients.strName
ORDER BY Sum(tblCommissions.curAmount) DESC;
Thanks very much for the help!