By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,444 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

Over 80 hours.

P: n/a
This is references to the post # 11 of the following thread..

Click link to view entire thread:

Is there anyway to make it like the following. If there is
overtime, then have Regular Time display = 80:00:00
If under 80:00:00, then display the correct hours
I could not get the original messages back via my ISP Google.
Anyway, It's just a matter of building up the calculations and
nesting them in IIF statements.

so if you have TotalTime (in seconds)
RegularTime is
iif(TotalTime 80*60*60,80*60*60,Totaltime).

OverTime is
iif(TotalTime 80*60*60,totaltime-80*60*60,0).

Those would go inside the SecToDur() function that I originally
provided in 2004

Public Function sec2dur(seconds As Long) As String
On Error Resume Next
Dim hrs As Long
Dim mins As Integer
Dim secs As Integer
hrs = Int(seconds / 3600)
mins = Int((seconds - (3600 * hrs)) / 60)
secs = seconds - (hrs * 3600 + mins * 60)
sec2dur = Format(hrs, "#,##0") & ":" & Format(mins, "00") & ":"
Format(secs, "00")
End Function

- Hide quoted text -
- Show quoted text -

Where exactly would I put the following lines in the sec2dur?

iif(TotalTime 80*60*60,80*60*60,Totaltime).

OverTime is
iif(TotalTime 80*60*60,totaltime-80*60*60,0).

I keep getting coding errors when I paste them.


Jul 11 '06 #1
Share this Question
Share on Google+
1 Reply

P: n/a
I would imagine that you'd have a summary query to gather the total
hours across several records, right? Then use a totals query to get
total time (in minutes).
Then if you divide by 60, you get hours. Then once you have that in
your totals query, you can base another query on the totals query.

RegularHrs: IIF(TotalHours>=40,40,TotalHours)
OT: IIF(TotalHours>40,TotalHours-40,0)

Jul 12 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.