Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execution time of the report 1

Status
Not open for further replies.

vikrantha

MIS
Aug 16, 2002
2
US
Hi, I was looking for a function with which I can store the total execution time of report in to a user variable on the report. Can I don that.

Thanks

 
Hello Vikranta,

The total execution time of a report is made up from several fases:
1. query analysis
2. data retrieval
3. formatting report(s)

I do not think there is a standard function that can monitor all these fases and come back with the duration.
The last fase is especially depended on power of your PC, number of other applications active etc.
Perhaps you could try something with the difference of Document-time and another timestamp.......... T. Blom
Information analyst
tbl@shimano-eu.com
 
You could take the time before and after the refresh with VBA, and assign the difference to an user variable.

Add the following code to the ThisDocument module of VBA. Refresh the document and you will have a variable called <Execution Time> with the time between before and after refresh.

[tt]
Option Explicit
Dim BeforeRefreshTime As Date

Private Sub Document_BeforeRefresh(Cancel As Boolean)
BeforeRefreshTime = Now
End Sub

Private Sub Document_AfterRefresh()
Dim ExecutionTime As Date
Dim FormattedTime As String
ExecutionTime = Now - BeforeRefreshTime
FormattedTime = Format(ExecutionTime, &quot;Hh:Nn:Ss&quot;)
On Error Resume Next
DocumentVariables.Add &quot;-&quot;, &quot;Execution Time&quot;
DocumentVariables(&quot;Execution Time&quot;).Formula = FormattedTime
End Sub
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top