I'm trying to time some intensive calculations in a vba program. I've been using the TIme function but it appears that the best resolution is in integral seconds.
Is there a way to get a timestamp or current time that includes milliseconds or fractions of a secnod in VBA? NOTE: I can't run the same calc 1000 times in a row and use an average.
Access stores Dates as Floating Point values. The Integer portion represents the number of Days since Dec 30, 1899. The fractional portion represents the number of seconds since midnight.
Sub TestTimer (strQueryName As String)
Dim sngStart As Single
Dim sngEnd As Single
Dim sngElapsed As Single
' Get start time.
sngStart = Timer
' Run query to be timed.
DoCmd.OpenQuery strQueryName, acNormal
' Get end time.
sngEnd = Timer
' Elapsed time.
sngElapsed = Format(sngEnd - sngStart, "Done")
MsgBox ("Query " & strQueryName & " ran for " & sngElapsed _
& " seconds.")
End Sub