Dan Waters
df.waters at comcast.net
Sun Dec 19 12:15:41 CST 2010
Hi Tony,
I did this timing thing a couple of times. The problem is that access
timing is only accurate to about a second, as your data shows. There is a
function named GetTickCount which will give you time (I think) in
milliseconds.
Put the following code into the same module where you are calling the
queries:
-----------------------
Public Declare Function GetTickCount Lib "kernel32" () As Long
Private MblnStartupTimes As Boolean
Private MvarStartupTimes() As Variant
Private MintProcedureCount As Integer
Private MlngStart As Long
-----------------------
Private Sub CollectStartupTimeInfo(stgProcedureName As String)
Dim lngDuration As Long
If MblnStartupTimes = False Then Exit Sub
lngDuration = GetTickCount - MlngStart
ReDim Preserve MvarStartupTimes(2, MintProcedureCount)
MvarStartupTimes(0, MintProcedureCount) = Now() '--
Procedure Time
MvarStartupTimes(1, MintProcedureCount) = stgProcedureName '--
Procedure Name
MvarStartupTimes(2, MintProcedureCount) = lngDuration '--
Milliseconds
MintProcedureCount = MintProcedureCount + 1
Exit Sub
ErrEx.Bookmark = BOOKMARK_ONERROR
End Sub
-----------------------
Now in your procedure which calls the queries, add this code:
-----------------------
Private Sub YourProcedure1()
MlngStart = GetTickCount
'-- Run Query 1
Call CollectStartupTimeInfo("YourProcedure1")
End Sub
-----------------------
Now, when you're done, put the array values into a table. (Obviously you
need to rewrite this.
----------------------
DoCmd.SetWarnings False
For intCount = 0 To UBound(MvarStartupTimes, 2)
stg = "INSERT INTO tblAdminStartupTimes ( ProcedureTime, Person,
ComputerName, ProcedureName, MilliSeconds ) IN '" & stgBEFullPath & "'" _
& " VALUES (#" & MvarStartupTimes(0, intCount) & "#, '" &
stgCurrentPerson & "', '" & stgComputerName & "', '" & MvarStartupTimes(1,
intCount) & "', " & MvarStartupTimes(2, intCount) & ")"
DoCmd.RunSQL stg
Next
DoCmd.SetWarnings True
----------------------
You can also rearrange to run all this in one procedure.
Good Luck,
Dan
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Tony Septav
Sent: Sunday, December 19, 2010 10:05 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] List Boxes
Hey All
Not a biggy, just would like to know out of curiosity.
I put a timer on my continuous forms to see how long it takes for the 9
queries to fire. Was trying to figure out what query was taking longer
then the others, so maybe I could approach it a different way and
increase the speed (many of the queries involve a set of sub queries).
What I found was interesting. When clicking on a specific record I
could get several different times to run all 9 queries and the times
were random when running a the queries
Times to complete in seconds
0.9999999997205
1.000000008
1.9999999998001
2.0000000016
I didn't matter what record I chose in the list I could get anyone of
the various times recorded above to run all 9 queries. Does anyone know
what would cause this???
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com