Access 2007 Sum Field (1 Viewer)

mjreiman

Registered User.
Local time
Yesterday, 22:54
Joined
Jan 29, 2010
Messages
25
In the past, I have been able to use this expression for a Sum field in an Access query. I have two tables in a query for a simple timesheet application. The two Tables are tblTimesheet (fields: TimesheetID(PK), WeekEnding, Day, Hours, Date, and Paid) and tblPaid (WeekEndingID(PK), Paid). If I remember correctly, I should be able to make a new field by entering: TotalHours: Sum([tblTimesheet].[Hours]) When I do that it says that I'm not including WeekEnding in the aggregate function. If I delete the WeekEnding field then it gives me the same error with whatever the first field displayed is.
 

wilpeter

Canadian enthusiast
Local time
Today, 00:54
Joined
Nov 27, 2009
Messages
211
Since this question was not answered, I'll chip in that you are likely not using the Totals feature and "Group By" whatever field you want the hours totalled. If all you require is a total for all fields that have a WeekEnding of a particular date, use that field with "Where" in its Total row; and put the criteria for the date. Don't include any fields that aren't being Grouped or totalled.
 

mjreiman

Registered User.
Local time
Yesterday, 22:54
Joined
Jan 29, 2010
Messages
25
I wanted to basically make the query contain the following fields: WeekEnding, TotalHours, and Paid. I prefer not to use things like the totals feature, just a quirk of mine. I discovered that if I go into SQL View and under my SELECT statement and simply include "Sum([Hours]) AS TotalHours" which essentially is the same exact thing, it works perfectly fine.
 

wilpeter

Canadian enthusiast
Local time
Today, 00:54
Joined
Nov 27, 2009
Messages
211
Yes, or without SQL: Glad you solved it.
 

Attachments

  • sumHours.JPG
    sumHours.JPG
    56 KB · Views: 145

Users who are viewing this thread

Top Bottom