Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access 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
  #1 (permalink)  
Old August 1st, 2006, 05:51 AM
Friend of Wrox
Points: 912, Level: 11
Points: 912, Level: 11 Points: 912, Level: 11 Points: 912, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: Dublin, , Ireland.
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default Elapsed Time

I am using the following code to show elapsed hours and minutes. The minutes are not showing up in the totals cal anyone help
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long
If IsNull(interval) = True Then Exit Function

hours = Int(CSng(interval * 24))

If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust hours

HoursAndMinutes = hours & ":" & Format(minutes, "00")
End Function
Thanks

Brendan Bartley
__________________
Brendan Bartley
  #2 (permalink)  
Old August 7th, 2006, 01:50 AM
Friend of Wrox
 
Join Date: Jul 2005
Location: Oklahoma City, OK, USA.
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This may helps:

 '-------------------------------------------------------------------
 ' This sample code separates a time interval into seven variables for
 ' the following values: days, hours, minutes, seconds, total time in
 ' hours, total time in minutes, and total time in seconds.
 '
 ' The interval argument is flexible; it can be a single value, an
 ' expression, or a field reference.
 '-------------------------------------------------------------------

 Dim totalhours As Long, totalminutes As Long, totalseconds As Long
 Dim days As Long, hours As Long, minutes As Long, seconds As Long
 Dim interval As Variant

 days = Int(CSng(interval))
 totalhours = Int(CSng(interval * 24))
 totalminutes = Int(CSng(interval * 1440))
 totalseconds = Int(CSng(interval * 86400))
 hours = totalhours Mod 24
 minutes = totalminutes Mod 60
 seconds = totalseconds Mod 60


So you code should be something like:

hours = (Int(CSng(interval * 24))) MOD 24
minutes = (Int(CSng(interval * 1440))) Mod 60

HoursAndMinutes = hours & ":" & Format(minutes, "00")

Boyd
"Hi Tech Coach"
Access Based Accounting/Business Solutions developer.
http://www.officeprogramming.com


Similar Threads
Thread Thread Starter Forum Replies Last Post
Time Shift time in minus time out lechalas Beginning VB 6 1 August 11th, 2008 01:56 PM
The timeout period elapsed prior to obtaining a co abinashpatra ASP.NET 1.0 and 1.1 Professional 0 July 4th, 2008 12:17 AM
time zone & day light time rajn ASP.NET 1.0 and 1.1 Professional 0 August 7th, 2007 05:02 PM
Need to calculate elapsed time. RayL Access VBA 4 May 24th, 2007 12:04 PM
Calculating Time elapsed on form load Brendan Bartley Access 0 June 21st, 2005 09:02 AM





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