Timer to assess runtime

  • Thread starter Thread starter Alejandro
  • Start date Start date
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
 
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.
 
Back
Top