From: Nancy via AccessMonster.com on
Thank you both for taking the time to help me. It seems that I've run in to
the real problem and maybe one of you could help me with it. It seems that
I'm having problems because I am trying to do a Sum of a Sum in the report
footer. So, I created an expression in the query that my report is based on
to do the Sum for me. However, when I add the totals option to the query and
select sum underneath the On and Off Std Hours, it doesn't sum it up for me
in the report. It just shows the last entry. So, I tried to manually create
it by placing the following in a new field:

On Sum: Sum([On Std Hours])

When I try to run that I receive the following message:

You tried to execute a query that does not include the specified expression
'Supervisor' as part of an aggregate function.

I can select for the Supervisor field to not be shown and the error message
returns with the next field name in line. I've included my SQL code below.
Thanks in advance for any help you can offer. This is driving me insane!

SELECT [Weekly Data].Supervisor, [Weekly Data].Date, [Weekly Data].Day,
[Employee Data].[Current Pay Rate], [Employee Data].[Clock Number] AS
[Employee Data_Clock Number], [Weekly Data].[Job Change], [Weekly Data].
[Contract Number], [Employee Data].Employee AS [Employee Data_Employee],
[Operation Listing Data Field].[Unit Hour], [Operation Listing Data Field].
[Hour Unit], [Operation Listing Data Field].Rate, [Operation Listing Data
Field].Description, [Operation Listing Data Field].[Op Number], [Employee
Data].[Pay Rate], [Employee Data].Bonus AS [Employee Data_Bonus], [Employee
Data].[Current Pay Rate] AS [Employee Data_Current Pay Rate], [Weekly Data].
[Clock Number] AS [Weekly Data_Clock Number], [Weekly Data].Employee AS
[Weekly Data_Employee], [Weekly Data].[Hourly Rate], [Weekly Data].Bonus AS
[Weekly Data_Bonus], [Weekly Data].[Current Pay Rate] AS [Weekly Data_Current
Pay Rate], [Weekly Data].[Op Number], [Weekly Data].Description, [Weekly Data]
.Code, [Weekly Data].Contract, [Weekly Data].Rate AS [Weekly Data_Rate],
[Weekly Data].Quantity, [Weekly Data].[On Std Hours], [Weekly Data].[Off Std
Hours], Sum([On Std Hours]) AS [On Sum], Sum([Off Std Hours]) AS [Off Sum]
FROM [Operation Listing Data Field] INNER JOIN ([Employee Data] INNER JOIN
[Weekly Data] ON [Employee Data].[Clock Number] = [Weekly Data].[Clock Number]
) ON ([Operation Listing Data Field].[Op Number] = [Weekly Data].[Op Number])
AND ([Operation Listing Data Field].[Op Number] = [Weekly Data].[Op Number]);


John Spencer wrote:
>You should probably use the exact same formula in the report footer as you are
>using elsewhere. Assuming that you are referencing fields in the report's
>record source, I would expect to see the following.
>
>=SUM(([On Std Hours]+[Off Std Hours] + IIF([On Std Hours]+[Off Std Hours]>40,
>.5* ([On Std Hours]+[Off Std Hours]-40), 0)) * [Employee Data_Rate])
>
>John Spencer
>Access MVP 2002-2005, 2007-2010
>The Hilltop Institute
>University of Maryland Baltimore County
>
>> Sorry, I should have explained better. I use the following formula in the
>> report footer
>[quoted text clipped - 26 lines]
>>>> a total loss of what could be causing this. Any help would be greatly
>>>> appreciated!

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-reports/201004/1