Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duplicate Fields Need to be added together by name

Status
Not open for further replies.

t5amec

Programmer
Aug 14, 2003
112
GB
Hello

I am trying to create a report for a list of employees and the amount of hours worked and by what project.

the layout is as follows
Code:
Name
George Adams
Project  AmecProject  TotalHours
C        66502        40
C        66502        1008
C        66502        336
C        66502        40
C        66502        40
C        66502        40
C        66502        40
ADMIN                 8
H        66508        190

But I want it to come up like so;
Code:
Name
George Adams
Project  AmecProject  TotalHours
C        66502        1544
H        66508        190
etc

I just want the values within AmecProject field to be calculated per AmecProject code and to not show a value for the AmecProject fields that are blank.

How would I go about getting this done.

Thank you for your help in advance.

Matt



Make Sense? I hope so (-:
 
I would perform this grouping and summing operation in a query and then use that query as the record source for the report.

Code:
Select A.Name, A.Project, A.AmecProject, Sum(A.Totalhours) as TotalHours 
FROM [i][red]yourtablename[/red][/i] as A 
Group By A.Name, A.Project, A.AmecProject 
HAVING Not IsNull(A.Project);

I think query SQL should do it for you. Let me know if this works. Just name and save the query and then idetnify it as the RecordSource for the report.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
thank you very much, but how would i modify it so that the blank fields do not show up?



Make Sense? I hope so (-:
 
Oh, sorry about that. I used the wrong field to check for nulls. Change the HAVING statement to the following:

Code:
HAVING Not IsNull(A.AmecProject);

Good luck.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top