Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 23rd, 2007, 09:19 AM
Authorized User
 
Join Date: Oct 2003
Posts: 25
Thanks: 1
Thanked 0 Times in 0 Posts
Default Need to calculate elapsed time.

I help to calculate elapsed time in a query. The Start and End Times are being stored in the Short Time format. I need to get the elapsed time in Hours, such as 1.25 hours.

Thanks,

Ray

 
Old May 24th, 2007, 06:48 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Where is the query running from, and where are you storing the values?

What you need to do is create seperate variables for start and end time and take their values before and after the query runs. Like:

Start Sub
Dim tStart, tEnd As Date

tStart = Now()
'post to table

'Run routine

tEnd = Now()
'post to table
'or calculate DateDiff()

End Sub


I use date/time since your query may run overnight?

Did this help any?

mmcdonal
 
Old May 24th, 2007, 09:54 AM
Authorized User
 
Join Date: Oct 2003
Posts: 25
Thanks: 1
Thanked 0 Times in 0 Posts
Default

The values are stored in a table. They will be entered using a form and we are looking to calculate the elapsed time for a production process.

Ray

 
Old May 24th, 2007, 10:24 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Sorry I cant; work on this now. Check out this article: http://office.microsoft.com/en-us/ac...102181033.aspx

Did that help?


mmcdonal
 
Old May 24th, 2007, 12:04 PM
Authorized User
 
Join Date: Oct 2003
Posts: 25
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks for the help, I got what I wanted using the DatePart function.

Ray






Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate time divovsky Access 2 March 15th, 2007 03:10 PM
Elapsed Time Brendan Bartley Access 1 August 7th, 2006 01:50 AM
Calculate Time sswingle Classic ASP Basics 1 April 10th, 2006 08:30 AM
Calculating Time elapsed on form load Brendan Bartley Access 0 June 21st, 2005 09:02 AM
calculate time between two dates RMorales2831 Access 1 February 13th, 2004 11:38 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.