how to add hours

icemonster

Registered User.
Local time
Today, 10:04
Joined
Jan 30, 2010
Messages
502
hi, how do i add hours? my hours is formatted this way. (hours:minutes)
how do i add a sum?
 
So you want to add two time values together? Have you just tried [Hours:Minutes Field]+#00:xx:00#, xx being the number of hours you want to add?
 
CalcHrsOneDay([tblSchedule]![StartHr],[tblSchedule]![EndHr]) < this is how my hours are displayed.

now, let say, i want to range the dates between 15 days, how do i add at the bottom of the report, what the total hours are?

can you give me more of an example please?
 
That looks like a function you've created, yes? What does it return, a number of hours worked in the one day? It would be good if you could explain a bit more clearly - as I understand it at the moment you've got a function that calculates hours between two times (which a simple [end time]-[start time] would probably accomplish too), and you want to calculate the number of hours worked between two dates? You'd need a date field for that, or alternatively (to use your example), create a for loop that runs 15 times, adding the hours worked incrementally to a variable, then presto, your total hours worked.
 
so yeah, its a function that gives me hours worked per day, now in my report, i had everything summed up, the rate, cause it also calculates the pay per day, now what i want is, on the hours worked per day column, is at the bottom of the report, it can give me a total of how many hours total regardless of the days, because eventually i will just put on a date range to view that report. how do i compute for the total?
 
@brianwarnock - no luck T_T

:confused:

Did you look at the example db?

He has a report of a column of times, 4573 pages worth, at the end he totals them to 1545557:20 hours:minutes is that not what you want to do?

Brian
 
yes that's exaclty what i want, but i keep getting mismatch error.

this is how my days per day is calculated:

Daily Hrs: CalcHrsOneDay([tblSchedule]![StartHr],[tblSchedule]![EndHr])

now how would i incorporate that to the formula that was given?
 
substitute your field [Daily hrs] for Timefield I would think

BTW its best not to have spaces in object names as they can lead to syntax errors as well as extra work.

Brian
 
i did. but i still get mismatch error. omg. the last thing i need to do for my db and i can't do it. oh no!!
 
Then my guess is that your function is returning a text field rather than a Date/Time field.

Brian
 
i looked at the table and it said it's a date and time field though, so what next for me?
 
Sorry for jumping in Brian, just thought maybe the OP could try casting to a Date. CDate() function.
 
Don't worry vba, I'm out of ideas and she who must be obeyed is calling me to eat so I'm out of here now.
Best of luck to all.

Brian
 
Don't worry vba, I'm out of ideas and she who must be obeyed is calling me to eat so I'm out of here now.
Best of luck to all.

Brian
Hehe!! She can never be disobeyed:p Enjoy your dinner.

icemonster: What is the expression that's given the error?
 
my hours are hours:minutes
i used this code:

=sum(val([daily hrs]))

but for some reason, it's only counting the hours, what about the minutes? :D
 
You want to get minutes from 1 to 59 right? What about hours?

I've not been following the thread and I can't download Brian's example atm (too many windows open :) ), what did Brian say you should use?
 
well yeah, i want to be able to add the hours and minutes. but instead with the code i have its only adding the hours T_T
 
well yeah, i want to be able to add the hours and minutes. but instead with the code i have its only adding the hours T_T
Oh I see. Just to clarify, you want to add hours to your time and ensure it updates both the hours and minutes appropriately right?
 

Users who are viewing this thread

Back
Top Bottom