Display macro running time in Form

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
 
S

Steve Schapel

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top