Timer to assess runtime

A

Alejandro

I want to add a timer to assess the total time a report is generated. I use following code but I get strange formats. I want to be able to display the elapsed time in seconds or minutes.

Suggestions?

Start = Timer ' Set start time.
... generate report
Finish = Timer ' Set end time.
TotalTime = Finish - Start ' Calculate total time.

Here code to format totaltime in seconds if less then a minute or else in minutes so I can add this information to a systems log.

Alexander
 
D

Dirk Goldgar

Alejandro said:
I want to add a timer to assess the total time a report is generated.
I use following code but I get strange formats. I want to be able to
display the elapsed time in seconds or minutes.

Suggestions?

Start = Timer ' Set start time.
... generate report
Finish = Timer ' Set end time.
TotalTime = Finish - Start ' Calculate total time.

Here code to format totaltime in seconds if less then a minute or
else in minutes so I can add this information to a systems log.

Alexander

How about adding this:

Dim strDisplayTime As String

strDisplayTime = TotalTime \ 60 & ":" & Format(TotalTime Mod 60,
"00")

? Any fractional seconds wil be rounded off.
 

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