Strange SUM function error

spleewars

Registered User.
Local time
Today, 12:35
Joined
Jan 28, 2011
Messages
28
The scenario is based on 2 data fields: "IN" and "OUT": both are time fields and the main function is to serve as a punch clock. In order to work out calculations and get the total time, both were passed into a query and set out the formula:

datediff ("n",[in],[out])

So to convert the raw time of the latter formula, i set a new one to divide the amount of 'datediff' into hours and minutes:

[totalhours]\60 & Format([totalhours] Mod 60, "\:00")

Everything's fine to here... however, when i loaded the query into a continuous form and set the SUM function into an unbound text box (so i could sum up all the totalhours) ERROR pops up. The control scorce of the textbox is:

=SUM([totalhours])\60 & Format(SUM([totalhours]) Mod 60, "\:00")

Obviously the textbox is set in the footer but still resolving the error.

What is the reason of the error?
Clara
 
I guess the question is, what is your goal? You want a form that will display 1 record per employee and the total number of hours they worked for a given time frame based on a query with a date range parameter?

I believe you're using the SUM function wrong. But once I know what exactly you're trying to accomplish, I can advise further.
 
Thanks Adam for your reply...

Actually this is all about a punch clock system. On a separate form i designed, a user select his ID and logs in his table of "In" and "Out" time, depends the hour of work he did.

The reason of the form is to give me a view of the working hours he did, lets say, for the month of March 2012 - the form automatically calculates the working hours and thats where the coding i posted in the latter post comes in
 
Not really 'strange!' You simply cannot run an Aggregate Function, such as SUM(), against a Calculated Field. You need to run it against the actual calculation you did, so it should be

Sum(DateDiff ("n",[in],[out])

and then use Format, as you did before, to tweak how it is displayed.

Linq ;0)>
 
Last edited:

Users who are viewing this thread

Back
Top Bottom