473,466 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Sum columns in a report

21 New Member
Good Day All, First let me apologize for posting this originally in the Access Article Forum. I recognized the mistake and I am now posting it in the correct Forum.

I have a report that shows the hours that are worked by employees, who get paid on a biweekly basis. There is a "Total Hours Worked" column that is further divided into "Week1" and "Week2." It looks like this example:

[HTML]Total Hours Worked
Week1 Week2
8.00
8.00
8.00
9.00
11.00
3.50
6.00
6.00
6.00
6.00
----------------
44.00 27.50[/HTML]

The reason I have the "Total Hours Worked" column divided into Week1 and Week2 is because I want to be able to calculate whether an employee has worked more than 40 hours per week for Overtime purposes.

The control source for the Week1 work hours is a field named txtWeek1 and here is the code that I use

Expand|Select|Wrap|Line Numbers
  1. =IIF([DateIn]-Forms!frmDates4Pay.txtDateBegin<7,(Format([TimeWorked],"#.00"))," ")
And the control source for the Week2 work hours is a field named txtWeek2 and here is the code that I use

Expand|Select|Wrap|Line Numbers
  1. =IIF([DateIn]-Forms!frmDates4Pay.txtDateBegin>6,(Format([TimeWorked],"#.00"))," ")
The code described above works just as I expect. However, I want to be able to add the columns separately, and my problem is that the fields that I am using to calculate the sum of the time worked is calculating both weeks for each field. I am using a simple Sum Statement for both total fields:

Expand|Select|Wrap|Line Numbers
  1. =Format(Sum([TimeWorked]),"#.00")
  2.  
Is there a way to sum only those hours under Week1 in a total field separately from the hours in Week2? Those fields are named txtSumWeek1 and txtSumWeek2. As it stands now, both of these fields has the two weeks total displayed. FYI, the user inputs the payperiod begin and end dates from a form named frmDates4Pay and the click event to preview the form filters all days worked to between date begin and date end of the payperiod.

I am running XP and using Access 2002 in 2000 mode.

Any assistance will be greatly appreciated,

David
May 8 '07 #1
6 1637
JConsulting
603 Recognized Expert Contributor
=sum([txtSumWeek1]) and sum([txtSumWeek2])
May 8 '07 #2
djsdaddy
21 New Member
Thanks JConsulting, I tried your suggestion and I am being asked to enter a parameter value for txtWeek1. I don't know if this makes a difference, but txtWeek1 and txtWeek2 are controls on the report.

Thanks again,

David
May 8 '07 #3
JConsulting
603 Recognized Expert Contributor
Thanks JConsulting, I tried your suggestion and I am being asked to enter a parameter value for txtWeek1. I don't know if this makes a difference, but txtWeek1 and txtWeek2 are controls on the report.

Thanks again,

David
I wasn't really clear I think..

You're referencing these on the section's footer in your report correct?

=sum([txtWeek1])
=sum([txtWeek2])
May 8 '07 #4
djsdaddy
21 New Member
That's correct, but I am now trying to get those figures in the query also. I've got to leave and work a short evening shift tonight, so it will probably be tomorrow morning before I can give you some feedback on my progress
May 9 '07 #5
djsdaddy
21 New Member
I wasn't really clear I think..

You're referencing these on the section's footer in your report correct?

=sum([txtWeek1])
=sum([txtWeek2])
Yes I am referencing these in the section's footer section of the report, and I would think that that code would work, but I came up with the following error:

[HTML]This expression is typed incorrectly, or is too complex to be evaluated. For example, a numeric expression contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables.[/HTML]

I calculated the figures for txtWeek1 and txtWeek2 in the query underlying the report and the numbers are reflected in the report just as I had expected. This is why the error is so baffling to me.

Any further suggestions?

Thanks in advance,

David
May 9 '07 #6
JConsulting
603 Recognized Expert Contributor
Yes I am referencing these in the section's footer section of the report, and I would think that that code would work, but I came up with the following error:

[HTML]This expression is typed incorrectly, or is too complex to be evaluated. For example, a numeric expression contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables.[/HTML]

I calculated the figures for txtWeek1 and txtWeek2 in the query underlying the report and the numbers are reflected in the report just as I had expected. This is why the error is so baffling to me.

Any further suggestions?

Thanks in advance,

David

check the field list and the name property of the boxes...make sure the names are correct.

Try moving the totals onto the page..or the report footer. see if they calculate there.
J
May 9 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: mary | last post by:
I need to display 10 fields (columns) to display in a crystal Report. When I am trying to print the report some of the columns are cutting off from the report. Is there any way to display the...
2
by: DFS | last post by:
Main report contains one large graph in the detail band (no detail records). Subreport snakes just fine (5 columns) when opening by itself. When I add it to the main report (in the report...
1
by: Peter Bailey | last post by:
I have a report that gives the classroom and then a list of students in it for a particular week. Thats fine if I want just one column with its associated rows of students. I have been asked...
6
by: Chuck | last post by:
I have a report with three columns, accross then down, and two groups. Currently the group headers are only one column wide and appear in the left hand column. How can I make the group header be...
2
by: Ross Hamilton | last post by:
Can anyone help me with this small problem. I have a report that is divided into 3 Columns using the page setup, It displays the report fields in 3 separate columns (Desc & Pg Num) but it only...
0
by: BerkshireGuy | last post by:
Hello everyone, I have a subreport that calculates a YTD average. The main report shows the averages by month. So the subreport has the same columns as the main report. Is there a way to...
1
by: Don Sealer | last post by:
I have a report that reports from a query. The report lists numbers. The problem is there are over 100 numbers. The report shows this as one column of numbers over 4 pages. How can I get...
2
by: scott.k.fraley | last post by:
....and the SELECT thats trying to pull from said Query doesn't like it one bit! ;) I'm working on this project (in Access 2002) and there is a report who's RecordSource is the following...
3
by: Niranjan | last post by:
I want create a report based on the crosstab query which normally returns about 50 - 60 columns. The columns have names of the counties and they keep changing for every session. Is there a way to...
1
by: jglabas | last post by:
For a report, I am using a query as my record source. The query produces 5 columns by 3272 records. The data in columns 1 & 2 (“Objective” and “Rating”) repeats every 409 records The data for...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.