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 / Forms Programming / August 2005

Tip: Looking for answers? Try searching our database.

Recording start and stop times on jobs

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michelle - 05 Aug 2005 06:16 GMT
Can you please have a look at the code below and tell me where I have gone
wrong.
I need to be able to log the start and stop times of each job and use those
times to calculate costing of job and payroll figs.
Am a virtual beginner at Access - based this code on another I was given for
a logon page.

Option Explicit
Dim dteStartJob As Time
Private Sub cmdStartJob_Click()
End Sub

Private Sub cmdStartJob_Click()
dteStartJob = Now
cmdStopJob.Visible = True
[AControl].SetFocus
cmdStartJob.Visible = False
End Sub

Private Sub cmdStopJob_Click()

Dim strSQL As String
strSQL = "Insert into tblJobTimes(TimeStartJob, TimeStopJob)Values (#" &
dteStartJob & "#,#" & Now & "#);"
CurrentDb.Execute strSQL, dbFailOnError
cmdStartJob.Visible = True
[AControl].SetFocus
cmdStopJob.Visible = False
End Sub
Chris B - 05 Aug 2005 07:31 GMT
Try just using DateDiff,
you would need 3 text boxes one labled startjob and another stopjob or
similar, in the third put this code =DateDiff("n",[startjob],[stopjob])/60,
the entries into the two time boxes can just be HH.NN (NN refers to minutes
in access) format, this will give your result in hours and portion of hours
if it worked out any minutes, 2ndly if the job goes over midnight then you
simply enter the times with the apppropiate dates thus 'YYYY/MM/DD HH.NN'
This calculates the hours between the dates and times.

>Can you please have a look at the code below and tell me where I have gone
>wrong.
[quoted text clipped - 25 lines]
>cmdStopJob.Visible = False
>End Sub
 
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.