Display macro running time in Form

  • Thread starter Thread starter MarkusJohn
  • Start date Start date
M

MarkusJohn

Hello Friends,

I have a quite massive access DB where I have to run daily queries on.
To execute a qeuery I have created a form with buttons.
Each button runs a private Sub Functions with several
"DoCmd.OpenQuery" statements.

In this form I want to have a text field or label, that shows the
elapsedf time from begin to end of the sub function.

How can I implement this??

Thanks for a hint;-)
Markus
 
Markus,

If you have "private Sub Functions" and "DoCmd.OpenQuery statements",
then you are talking about VBA procedures, which in Access are quite
different from macros.

You could use code like this:

Dim StartTime As Date
Dim EndTime As Date
Dim ElapsedTime As Integer

StartTime = Now
....
<your OpenQuery thingies etc>
....
EndTime = Now
ElapsedTime = DateDiff("s",StartTime,EndTime)
Me.YourLabel.Caption = ElapsedTime & " seconds"

This only shows the time in whole seconds. Not sure if that's what you
were looking for.
 
Back
Top