Connecting Tech Pros Worldwide Help | Site Map

Timing a proecess in Access2000

  #1  
Old November 12th, 2005, 04:01 PM
Lauren Quantrell
Guest
 
Posts: n/a
Is there as simple way to time a process (down to the ms) while
running Access2000 VBA code? I want to test the time taken to run
various functions.
  #2  
Old November 12th, 2005, 04:01 PM
paii, Ron
Guest
 
Posts: n/a

re: Timing a proecess in Access2000


Save the time at the start and end of the function then output end - start
time.

"Lauren Quantrell" <laurenquantrell@hotmail.com> wrote in message
news:47e5bd72.0311030703.59cfcca4@posting.google.c om...[color=blue]
> Is there as simple way to time a process (down to the ms) while
> running Access2000 VBA code? I want to test the time taken to run
> various functions.[/color]


  #3  
Old November 12th, 2005, 04:02 PM
Pieter Linden
Guest
 
Posts: n/a

re: Timing a proecess in Access2000


laurenquantrell@hotmail.com (Lauren Quantrell) wrote in message news:<47e5bd72.0311030703.59cfcca4@posting.google. com>...[color=blue]
> Is there as simple way to time a process (down to the ms) while
> running Access2000 VBA code? I want to test the time taken to run
> various functions.[/color]

use GetTickCount... from www.mvps.org/vbnet

'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''
' Copyright ©1996-2003 VBnet, Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''
' Distribution: You can freely use this code in your own
' applications, but you may not reproduce
' or publish this code on any web site,
' online service, or distribute as source
' on any media without express permission.
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private tstart As Single

Private Enum ElapsedTimeType
ttMilliseconds = 1
ttSeconds = 2
ttMinutes = 3
End Enum


Private Function GetElapsedTime(dwTimeType As ElapsedTimeType) As Single

Dim divisor As Long

Select Case dwTimeType
Case ttMilliseconds: divisor = 1
Case ttSeconds: divisor = 1000
Case ttMinutes: divisor = 60000
End Select

GetElapsedTime = (GetTickCount() - tstart) / divisor

End Function


Private Sub Form_Load()

'Assign the current tick count
'as the tick start point. Failure
'to do this will return the number
'of ticks since Windows was last
'rebooted. (Note: elapsed time is
'stored as a DWORD value in Windows.
'Therefore, the time will wrap around
'to zero if the system is run continuously
'for 49.7 days. If a higher resolution
'timer is required, use a multimedia
'or high-resolution timer.
tstart = GetTickCount()

End Sub
  #4  
Old November 12th, 2005, 04:03 PM
Tom van Stiphout
Guest
 
Posts: n/a

re: Timing a proecess in Access2000


On 3 Nov 2003 11:30:47 -0800, pietlinden@hotmail.com (Pieter Linden)
wrote:

Using GetTickCount, you could write your own class. I called mine
clsStopwatch, and it has methods like Start, Stop, and Peek.

Also please note that "down to the ms" may be somewhat difficult.
Simple timers like GetTickCount don't necessarily have that
resolution. If your function is fast, you may want to run it a
thousand or a million times, rather than once.

-Tom.

[color=blue]
>laurenquantrell@hotmail.com (Lauren Quantrell) wrote in message news:<47e5bd72.0311030703.59cfcca4@posting.google. com>...[color=green]
>> Is there as simple way to time a process (down to the ms) while
>> running Access2000 VBA code? I want to test the time taken to run
>> various functions.[/color]
>
>use GetTickCount... from www.mvps.org/vbnet
>[/color]
<clip>

  #5  
Old November 12th, 2005, 04:05 PM
Erik Rudbeck
Guest
 
Posts: n/a

re: Timing a proecess in Access2000



"Lauren Quantrell" <laurenquantrell@hotmail.com> wrote in message
news:47e5bd72.0311030703.59cfcca4@posting.google.c om...[color=blue]
> Is there as simple way to time a process (down to the ms) while
> running Access2000 VBA code? I want to test the time taken to run
> various functions.[/color]

dblTStart = Timer()
....Do something
dblTStop = Timer()
Debug.Print Int((dblTStop - dblTStart) * 1000) & " ms"

Erik Rudbeck


Closed Thread