Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / April 2007

Tip: Looking for answers? Try searching our database.

time addition

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AttackIP - 29 Apr 2007 20:56 GMT
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??
Ofer Cohen - 29 Apr 2007 21:04 GMT
In the Sum text box you need to use the formula that you use to calculate the
time different

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

Signature

Good Luck
BS"D

> I have a module that computes elapsed time for hours worked   DutyTime
>
[quoted text clipped - 8 lines]
> I've tried      =Sum([DutyTime]),
> but I get a "expression is too complex..." help??
AttackIP - 29 Apr 2007 21:56 GMT
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
[quoted text clipped - 13 lines]
> > I've tried      =Sum([DutyTime]),
> > but I get a "expression is too complex..." help??
Ofer Cohen - 29 Apr 2007 22:06 GMT
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]

Signature

Good Luck
BS"D

> I don't think I can do that.  The formula for DutyTime is a module, and looks
> like this:
[quoted text clipped - 38 lines]
> > > I've tried      =Sum([DutyTime]),
> > > but I get a "expression is too complex..." help??
AttackIP - 30 Apr 2007 03:42 GMT
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...

> If the Control Source of the Text Box in the Report is
> =GetElapsedTime([FieldName])
[quoted text clipped - 54 lines]
> > > > I've tried      =Sum([DutyTime]),
> > > > but I get a "expression is too complex..." help??
Ofer Cohen - 30 Apr 2007 10:26 GMT
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?

Signature

Good Luck
BS"D

> 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
[quoted text clipped - 61 lines]
> > > > > I've tried      =Sum([DutyTime]),
> > > > > but I get a "expression is too complex..." help??
Ofer Cohen - 30 Apr 2007 11:34 GMT
Sorry,
27 hrs and not 3

Signature

Good Luck
BS"D

> Well, the time can be more then 24 hrs usually if you move between dates.
>
[quoted text clipped - 71 lines]
> > > > > > I've tried      =Sum([DutyTime]),
> > > > > > but I get a "expression is too complex..." help??
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.