Dsum question getting running total in a query

A

Anne

Here is my expression:
TotalHours: DSum("Hours","tblHoursCalculated ","EmployeeId<=" &
[MyEmployeeID] & "dayofweek<=" & [Mydayofweek])

MyEmployee and MyDayofWeek are aliases

All items are numeric fields.
Pertinent fields in table TblHoursCalculated are:
Hours - numeric
EmployeeID - numberic with Alias of MyEmployeeId
DayofWeek (representing 1st thru last day of week) with Alias of
MyDayofWeek, 1st day of the week is Wednesday

I am trying to get a column which adds the hours per day by employee so I
can determine where overtime starts.
I am not sure if I even needed to convert the workdate to a day of the week.
The actual date should be enough.
Here is what I am trying to tatal:
employee 1 -07/13/05 employee Hours worked 8 - Total 8 hrs
employee 1- 07/14/05 employee Hours worked 8 - Total 16 hrs
employee 1 -07/15/05 employee Hours worked 10 - Total 26
employee 1 -07/18/05 employee Hours worked 10 - Total 36
employee 1 -07/19/05 employee Hours worked 10 - Total 46
next
employee 2- 07/13/05 employee Hours worked 9 - Total 9 hrs
employee 2- 07/14/05 employee Hours worked 8 - Total 17 hrs
employee 2 -07/15/05 employee Hours worked 10 - Total 27
employee 2 -07/18/05 employee Hours worked 12 - Total 39
employee 2 -07/19/05 employee Hours worked 10 - Total 49
next
and so on and so on

Seems simple, but all I get is #Error
I think I have a problem with just getting the right brackets or comma and
apostrohhies

Oh, another question, can this be run on a query instead of a table?
Anne
Using Access 2003 in 2000 format

Anne
 
V

Van T. Dinh

* You are missing the Boolean "And" operator in the criteria. The ampersand
"&" is the String concatenation operator which probably got confused with
"And".

* The "<=" for the EmployeeID condition probably should be "=".

* You cannot use Aliases for "later" calculations in the Query. I am not
sure whether the concept "later" even exists in JET processing.

Post the SQL String of your Query.
 

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