Expression on a report

G

Guest

I have an unbound text box with the expression =Sum([Employee Regular Time]).
I want to categorize by text box [Shift]. For example, the sum of shift 1 is
12 hours, shift 2 is 24 hours, shift 3 is 18 hours. Can I have an unbound
text box show the sum of each Employee Regular Time by shift. I tried writing
a query that was bound to my initial query. The only problem is that there
was criteria place in the initial query. When I got to the report, The report
asked for Date 4 times (I believe because of initial query and then 3
shifts.) Any help would be appreciated.
 
G

Guest

You can total a subset of records with a general expression like:
=Sum(Abs(..True/FalseExpression..) * [NumericFieldToSum])
In your case, this would be
=Sum(Abs([Shift]=1) * [Employee Regular Time])
 
G

Guest

I tried it in a text box control source and it brought back an error? any
other ideas?

Duane Hookom said:
You can total a subset of records with a general expression like:
=Sum(Abs(..True/FalseExpression..) * [NumericFieldToSum])
In your case, this would be
=Sum(Abs([Shift]=1) * [Employee Regular Time])

--
Duane Hookom
Microsoft Access MVP


oxicottin said:
I have an unbound text box with the expression =Sum([Employee Regular Time]).
I want to categorize by text box [Shift]. For example, the sum of shift 1 is
12 hours, shift 2 is 24 hours, shift 3 is 18 hours. Can I have an unbound
text box show the sum of each Employee Regular Time by shift. I tried writing
a query that was bound to my initial query. The only problem is that there
was criteria place in the initial query. When I got to the report, The report
asked for Date 4 times (I believe because of initial query and then 3
shifts.) Any help would be appreciated.
 
G

Guest

Tried what? What was the Control Source? What section of the report? "brought
back an error"... what error?

--
Duane Hookom
Microsoft Access MVP


oxicottin said:
I tried it in a text box control source and it brought back an error? any
other ideas?

Duane Hookom said:
You can total a subset of records with a general expression like:
=Sum(Abs(..True/FalseExpression..) * [NumericFieldToSum])
In your case, this would be
=Sum(Abs([Shift]=1) * [Employee Regular Time])

--
Duane Hookom
Microsoft Access MVP


oxicottin said:
I have an unbound text box with the expression =Sum([Employee Regular Time]).
I want to categorize by text box [Shift]. For example, the sum of shift 1 is
12 hours, shift 2 is 24 hours, shift 3 is 18 hours. Can I have an unbound
text box show the sum of each Employee Regular Time by shift. I tried writing
a query that was bound to my initial query. The only problem is that there
was criteria place in the initial query. When I got to the report, The report
asked for Date 4 times (I believe because of initial query and then 3
shifts.) Any help would be appreciated.
 
G

Guest

Ok, I tried adding =Sum(Abs([Shift]=1) * [Employee Regular Time]) into a text
box control source on the Reports Page Footer. When I ran the report It asked
me for a Date like it is supposed to and when the report came up the text
box with the "=Sum(Abs([Shift]=1) * [Employee Regular Time])" gave an error.
There was no pop up or anything like that it just said error in the text box.



Duane Hookom said:
Tried what? What was the Control Source? What section of the report? "brought
back an error"... what error?

--
Duane Hookom
Microsoft Access MVP


oxicottin said:
I tried it in a text box control source and it brought back an error? any
other ideas?

Duane Hookom said:
You can total a subset of records with a general expression like:
=Sum(Abs(..True/FalseExpression..) * [NumericFieldToSum])
In your case, this would be
=Sum(Abs([Shift]=1) * [Employee Regular Time])

--
Duane Hookom
Microsoft Access MVP


:

I have an unbound text box with the expression =Sum([Employee Regular Time]).
I want to categorize by text box [Shift]. For example, the sum of shift 1 is
12 hours, shift 2 is 24 hours, shift 3 is 18 hours. Can I have an unbound
text box show the sum of each Employee Regular Time by shift. I tried writing
a query that was bound to my initial query. The only problem is that there
was criteria place in the initial query. When I got to the report, The report
asked for Date 4 times (I believe because of initial query and then 3
shifts.) Any help would be appreciated.
 
G

Guest

The text box needs to be in a Report or Group Header or Footer section. You
can't easily aggregate records in Page sections.

--
Duane Hookom
Microsoft Access MVP


oxicottin said:
Ok, I tried adding =Sum(Abs([Shift]=1) * [Employee Regular Time]) into a text
box control source on the Reports Page Footer. When I ran the report It asked
me for a Date like it is supposed to and when the report came up the text
box with the "=Sum(Abs([Shift]=1) * [Employee Regular Time])" gave an error.
There was no pop up or anything like that it just said error in the text box.



Duane Hookom said:
Tried what? What was the Control Source? What section of the report? "brought
back an error"... what error?

--
Duane Hookom
Microsoft Access MVP


oxicottin said:
I tried it in a text box control source and it brought back an error? any
other ideas?

:

You can total a subset of records with a general expression like:
=Sum(Abs(..True/FalseExpression..) * [NumericFieldToSum])
In your case, this would be
=Sum(Abs([Shift]=1) * [Employee Regular Time])

--
Duane Hookom
Microsoft Access MVP


:

I have an unbound text box with the expression =Sum([Employee Regular Time]).
I want to categorize by text box [Shift]. For example, the sum of shift 1 is
12 hours, shift 2 is 24 hours, shift 3 is 18 hours. Can I have an unbound
text box show the sum of each Employee Regular Time by shift. I tried writing
a query that was bound to my initial query. The only problem is that there
was criteria place in the initial query. When I got to the report, The report
asked for Date 4 times (I believe because of initial query and then 3
shifts.) Any help would be appreciated.
 
G

Guest

Thanks a million!!! I was putting it in the wrong spot!!!!


Duane Hookom said:
The text box needs to be in a Report or Group Header or Footer section. You
can't easily aggregate records in Page sections.

--
Duane Hookom
Microsoft Access MVP


oxicottin said:
Ok, I tried adding =Sum(Abs([Shift]=1) * [Employee Regular Time]) into a text
box control source on the Reports Page Footer. When I ran the report It asked
me for a Date like it is supposed to and when the report came up the text
box with the "=Sum(Abs([Shift]=1) * [Employee Regular Time])" gave an error.
There was no pop up or anything like that it just said error in the text box.



Duane Hookom said:
Tried what? What was the Control Source? What section of the report? "brought
back an error"... what error?

--
Duane Hookom
Microsoft Access MVP


:

I tried it in a text box control source and it brought back an error? any
other ideas?

:

You can total a subset of records with a general expression like:
=Sum(Abs(..True/FalseExpression..) * [NumericFieldToSum])
In your case, this would be
=Sum(Abs([Shift]=1) * [Employee Regular Time])

--
Duane Hookom
Microsoft Access MVP


:

I have an unbound text box with the expression =Sum([Employee Regular Time]).
I want to categorize by text box [Shift]. For example, the sum of shift 1 is
12 hours, shift 2 is 24 hours, shift 3 is 18 hours. Can I have an unbound
text box show the sum of each Employee Regular Time by shift. I tried writing
a query that was bound to my initial query. The only problem is that there
was criteria place in the initial query. When I got to the report, The report
asked for Date 4 times (I believe because of initial query and then 3
shifts.) Any help would be appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top