time addition

G

Guest

I have a module that computes elapsed time for hours worked DutyTime

In a report I show time on duty, time off duty, and hours worked
It looks like this
DutyIn DutyOut
DutyTime
01/01/07 0730 01/01/07 1745 10:15
01/02/07 0900 01/02/07 1530 6:30

I want to total the duty time (hours worked) column 16:45
I've tried =Sum([DutyTime]),
but I get a "expression is too complex..." help??
 
G

Guest

In the Sum text box you need to use the formula that you use to calculate the
time different

=Sum(DateDiff("h",DutyIn ,DutyOut))
 
G

Guest

I don't think I can do that. The formula for DutyTime is a module, and looks
like this:

Function GetElapsedTime(interval)
Dim LngHours As Long, LngMinutes As Long

If IsNull(interval) Then
GetElapsedTime = 0
Else
interval = interval + 0.000006
LngHours = Int(interval * 24)
LngMinutes = Int(interval * 1440) Mod 60

GetElapsedTime = LngHours & " Hrs. " & LngMinutes & " Min. "
End If

End Function


This calculates DutyTime even if the DutyOut is a clander day later than
DutyIn
ie.
DutyIn 01/01/07 2100 DutyOut 01/02/07 0600 DutyTime= 9:0 hrs

Is my basic time calculation module more complex than it needs to be?






Ofer Cohen said:
In the Sum text box you need to use the formula that you use to calculate the
time different

=Sum(DateDiff("h",DutyIn ,DutyOut))


--
Good Luck
BS"D


AttackIP said:
I have a module that computes elapsed time for hours worked DutyTime

In a report I show time on duty, time off duty, and hours worked
It looks like this
DutyIn DutyOut
DutyTime
01/01/07 0730 01/01/07 1745 10:15
01/02/07 0900 01/02/07 1530 6:30

I want to total the duty time (hours worked) column 16:45
I've tried =Sum([DutyTime]),
but I get a "expression is too complex..." help??
 
G

Guest

If the Control Source of the Text Box in the Report is
=GetElapsedTime([FieldName])

Then in the Sum field you can use
=Sum(GetElapsedTime([FieldName]))

Or, another option.
Create another text box in the report, identical to the text box that
display the time different.
Set two of it's prperties:
Visible = No
RunningSum = Yes

In the report footer you can refer to that text box
=[NewTextBoxName]

--
Good Luck
BS"D


AttackIP said:
I don't think I can do that. The formula for DutyTime is a module, and looks
like this:

Function GetElapsedTime(interval)
Dim LngHours As Long, LngMinutes As Long

If IsNull(interval) Then
GetElapsedTime = 0
Else
interval = interval + 0.000006
LngHours = Int(interval * 24)
LngMinutes = Int(interval * 1440) Mod 60

GetElapsedTime = LngHours & " Hrs. " & LngMinutes & " Min. "
End If

End Function


This calculates DutyTime even if the DutyOut is a clander day later than
DutyIn
ie.
DutyIn 01/01/07 2100 DutyOut 01/02/07 0600 DutyTime= 9:0 hrs

Is my basic time calculation module more complex than it needs to be?






Ofer Cohen said:
In the Sum text box you need to use the formula that you use to calculate the
time different

=Sum(DateDiff("h",DutyIn ,DutyOut))


--
Good Luck
BS"D


AttackIP said:
I have a module that computes elapsed time for hours worked DutyTime

In a report I show time on duty, time off duty, and hours worked
It looks like this
DutyIn DutyOut
DutyTime
01/01/07 0730 01/01/07 1745 10:15
01/02/07 0900 01/02/07 1530 6:30

I want to total the duty time (hours worked) column 16:45
I've tried =Sum([DutyTime]),
but I get a "expression is too complex..." help??
 
G

Guest

OK, got it! Now one more issue. The DutyTime is displayed as a short time
ie. 6:45 for 6hrs 45mins worked. If the sum of DutyTime is greater than
24hrs (say 34hrs 15 mins), it is displayed as 10:15 (which would be 34:15-24
since short time can only display time as 00:00). How can I force it to
show 34:15 ? Or 134:15 for that matter, if that's the total number of hours
worked...

Ofer Cohen said:
If the Control Source of the Text Box in the Report is
=GetElapsedTime([FieldName])

Then in the Sum field you can use
=Sum(GetElapsedTime([FieldName]))

Or, another option.
Create another text box in the report, identical to the text box that
display the time different.
Set two of it's prperties:
Visible = No
RunningSum = Yes

In the report footer you can refer to that text box
=[NewTextBoxName]

--
Good Luck
BS"D


AttackIP said:
I don't think I can do that. The formula for DutyTime is a module, and looks
like this:

Function GetElapsedTime(interval)
Dim LngHours As Long, LngMinutes As Long

If IsNull(interval) Then
GetElapsedTime = 0
Else
interval = interval + 0.000006
LngHours = Int(interval * 24)
LngMinutes = Int(interval * 1440) Mod 60

GetElapsedTime = LngHours & " Hrs. " & LngMinutes & " Min. "
End If

End Function


This calculates DutyTime even if the DutyOut is a clander day later than
DutyIn
ie.
DutyIn 01/01/07 2100 DutyOut 01/02/07 0600 DutyTime= 9:0 hrs

Is my basic time calculation module more complex than it needs to be?






Ofer Cohen said:
In the Sum text box you need to use the formula that you use to calculate the
time different

=Sum(DateDiff("h",DutyIn ,DutyOut))


--
Good Luck
BS"D


:

I have a module that computes elapsed time for hours worked DutyTime

In a report I show time on duty, time off duty, and hours worked
It looks like this
DutyIn DutyOut
DutyTime
01/01/07 0730 01/01/07 1745 10:15
01/02/07 0900 01/02/07 1530 6:30

I want to total the duty time (hours worked) column 16:45
I've tried =Sum([DutyTime]),
but I get a "expression is too complex..." help??
 
G

Guest

Well, the time can be more then 24 hrs usually if you move between dates.

If you add a date to that field it will calculate the different as it
should, other wise how ca you tell if

Start 11:00 AM
Finish 2:00 PM

it's 25 hrs and not 3?

--
Good Luck
BS"D


AttackIP said:
OK, got it! Now one more issue. The DutyTime is displayed as a short time
ie. 6:45 for 6hrs 45mins worked. If the sum of DutyTime is greater than
24hrs (say 34hrs 15 mins), it is displayed as 10:15 (which would be 34:15-24
since short time can only display time as 00:00). How can I force it to
show 34:15 ? Or 134:15 for that matter, if that's the total number of hours
worked...

Ofer Cohen said:
If the Control Source of the Text Box in the Report is
=GetElapsedTime([FieldName])

Then in the Sum field you can use
=Sum(GetElapsedTime([FieldName]))

Or, another option.
Create another text box in the report, identical to the text box that
display the time different.
Set two of it's prperties:
Visible = No
RunningSum = Yes

In the report footer you can refer to that text box
=[NewTextBoxName]

--
Good Luck
BS"D


AttackIP said:
I don't think I can do that. The formula for DutyTime is a module, and looks
like this:

Function GetElapsedTime(interval)
Dim LngHours As Long, LngMinutes As Long

If IsNull(interval) Then
GetElapsedTime = 0
Else
interval = interval + 0.000006
LngHours = Int(interval * 24)
LngMinutes = Int(interval * 1440) Mod 60

GetElapsedTime = LngHours & " Hrs. " & LngMinutes & " Min. "
End If

End Function


This calculates DutyTime even if the DutyOut is a clander day later than
DutyIn
ie.
DutyIn 01/01/07 2100 DutyOut 01/02/07 0600 DutyTime= 9:0 hrs

Is my basic time calculation module more complex than it needs to be?






:

In the Sum text box you need to use the formula that you use to calculate the
time different

=Sum(DateDiff("h",DutyIn ,DutyOut))


--
Good Luck
BS"D


:

I have a module that computes elapsed time for hours worked DutyTime

In a report I show time on duty, time off duty, and hours worked
It looks like this
DutyIn DutyOut
DutyTime
01/01/07 0730 01/01/07 1745 10:15
01/02/07 0900 01/02/07 1530 6:30

I want to total the duty time (hours worked) column 16:45
I've tried =Sum([DutyTime]),
but I get a "expression is too complex..." help??
 
G

Guest

Sorry,
27 hrs and not 3

--
Good Luck
BS"D


Ofer Cohen said:
Well, the time can be more then 24 hrs usually if you move between dates.

If you add a date to that field it will calculate the different as it
should, other wise how ca you tell if

Start 11:00 AM
Finish 2:00 PM

it's 25 hrs and not 3?

--
Good Luck
BS"D


AttackIP said:
OK, got it! Now one more issue. The DutyTime is displayed as a short time
ie. 6:45 for 6hrs 45mins worked. If the sum of DutyTime is greater than
24hrs (say 34hrs 15 mins), it is displayed as 10:15 (which would be 34:15-24
since short time can only display time as 00:00). How can I force it to
show 34:15 ? Or 134:15 for that matter, if that's the total number of hours
worked...

Ofer Cohen said:
If the Control Source of the Text Box in the Report is
=GetElapsedTime([FieldName])

Then in the Sum field you can use
=Sum(GetElapsedTime([FieldName]))

Or, another option.
Create another text box in the report, identical to the text box that
display the time different.
Set two of it's prperties:
Visible = No
RunningSum = Yes

In the report footer you can refer to that text box
=[NewTextBoxName]

--
Good Luck
BS"D


:

I don't think I can do that. The formula for DutyTime is a module, and looks
like this:

Function GetElapsedTime(interval)
Dim LngHours As Long, LngMinutes As Long

If IsNull(interval) Then
GetElapsedTime = 0
Else
interval = interval + 0.000006
LngHours = Int(interval * 24)
LngMinutes = Int(interval * 1440) Mod 60

GetElapsedTime = LngHours & " Hrs. " & LngMinutes & " Min. "
End If

End Function


This calculates DutyTime even if the DutyOut is a clander day later than
DutyIn
ie.
DutyIn 01/01/07 2100 DutyOut 01/02/07 0600 DutyTime= 9:0 hrs

Is my basic time calculation module more complex than it needs to be?






:

In the Sum text box you need to use the formula that you use to calculate the
time different

=Sum(DateDiff("h",DutyIn ,DutyOut))


--
Good Luck
BS"D


:

I have a module that computes elapsed time for hours worked DutyTime

In a report I show time on duty, time off duty, and hours worked
It looks like this
DutyIn DutyOut
DutyTime
01/01/07 0730 01/01/07 1745 10:15
01/02/07 0900 01/02/07 1530 6:30

I want to total the duty time (hours worked) column 16:45
I've tried =Sum([DutyTime]),
but I get a "expression is too complex..." help??
 

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