Wrox Programmer Forums
|
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 September 21st, 2004, 09:49 AM
Authorized User
 
Join Date: Sep 2004
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Paulsh Send a message via Yahoo to Paulsh
Default Stop Watch

I am trying to record a record in a database each time I hit the enter button. I want to record a DATE/TIME field but more specifically I just need the extended time. In other words hh:mm:ss:ss where the final two "ss" refer to the miliseconds. Is this possible and if so, how do I achieve thsi.

Thanks in advance.
Paul

__________________
Paul
 
Old September 22nd, 2004, 09:48 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 120
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have you tried the GetSystemTime API call?

Here's the entry from the API Guide:

Code:
Private Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
Private Type SYSTEMTIME
    wYear As Integer
    wMonth As Integer
    wDayOfWeek As Integer
    wDay As Integer
    wHour As Integer
    wMinute As Integer
    wSecond As Integer
    wMilliseconds As Integer
End Type
Private Sub Form_Load()
    'KPD-Team 1998
    'URL: http://www.allapi.net/
    '[email protected]
    Dim SysTime As SYSTEMTIME
    'Get the system time
    GetSystemTime SysTime
    'Print it to the form
    Debug.Print "The System Date is:" & SysTime.wMonth & "-" & SysTime.wDay & "-" & SysTime.wYear
    Me.Print "The System Time is:" & SysTime.wHour & ":" & SysTime.wMinute & ":" & SysTime.wSecond & ":" & SysTime.wMilliSeconds
End Sub

Brian Skelton
Braxis Computer Services Ltd.
 
Old September 22nd, 2004, 11:06 AM
Authorized User
 
Join Date: Sep 2004
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Paulsh Send a message via Yahoo to Paulsh
Default

Thank you very much. This works a treat.
I now have the challenge of determining how to maniputate SYSTEMTIME variable within a database record.

 
Old September 22nd, 2004, 12:10 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 120
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm not sure why you need the milliseconds, so I may be totally off base, but I would probably hold the standard date/time data in a date time field and then create a seperate integer field to hold the millisecond data.


Brian Skelton
Braxis Computer Services Ltd.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop button won't stop loop JDShaffer Visual Basic 2008 Essentials 3 May 23rd, 2008 03:22 PM
Stop watch rohit_ghosh Access VBA 2 May 3rd, 2007 04:14 AM
Watch Window is disabled LaFeverMF ADO.NET 1 July 21st, 2004 11:32 PM
JS/ASP watch mega Javascript 5 April 29th, 2004 03:03 PM
digital watch StreetSweaper C# 3 December 30th, 2003 05:00 AM





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