Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 1st, 2006, 06: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
Reply With Quote
  #2 (permalink)  
Old August 7th, 2006, 02: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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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



All times are GMT -4. The time now is 02:20 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.