darkhelmutis
New member
- Local time
- Yesterday, 22:11
- Joined
- Nov 11, 2008
- Messages
- 3
Is there a way to measure how long it takes a query to run in Access 2007? I have a macro that will do it, but it is somewhat buggy i.e. after it runs Access tends to lock up, not show the results, etc. Is there a better way to do this? Using a stopwatch isn't accurate enough, but I thought of it!!
Thanks,
DH
Here is a description of my method:
Basically, I set each commandbutton's onclick event to run an [event procedure] and the macro it should run in the Tag property. This command runs the getTime module I created and the macro name in the Tag is passed as an argument. I use DoCmd.RunMacro and the passed argument to run the intended macro:
Private Sub Command0_Click()
getTime (Command0.Tag)
End Sub
Sub getTime(ByVal strMacroName As String)
Dim startTime As Double
Dim endTime As Double
startTime = Time() 'get start time
DoCmd.RunMacro strMacroName, 1 'run the macro
endTime = Time() 'get end time
MsgBox (endTime - startTime) * 24 * 60 * 60 'calculate run time in seconds
End Sub
Thanks,
DH
Here is a description of my method:
Basically, I set each commandbutton's onclick event to run an [event procedure] and the macro it should run in the Tag property. This command runs the getTime module I created and the macro name in the Tag is passed as an argument. I use DoCmd.RunMacro and the passed argument to run the intended macro:
Private Sub Command0_Click()
getTime (Command0.Tag)
End Sub
Sub getTime(ByVal strMacroName As String)
Dim startTime As Double
Dim endTime As Double
startTime = Time() 'get start time
DoCmd.RunMacro strMacroName, 1 'run the macro
endTime = Time() 'get end time
MsgBox (endTime - startTime) * 24 * 60 * 60 'calculate run time in seconds
End Sub