Elasped Time of the query

accessman2

Registered User.
Local time
Today, 15:38
Joined
Sep 15, 2005
Messages
335
Hi,
I have a question.

When I run the query, I want to know how long it takes to run.

How can I writes and add the function in the query for the timer.

Thanks.
 
Closest you can come is use a procedure. Capture TIMER then execute the query (using docmd) and then capture TIMER again. Subtract the two and I think devide the results by 100 to obtain seconds.
You could try including a field in your query that returns NOW() which would be a DATE TIME format, then return the MIN and MAX from your query of that field, maybe.
But I think TIMER is a better indicator.
 
How to do capture Timer?

Could you show the ways for me? Thanks a lot.
 
Can I ask, why do you want to know this?

Is it important to the result?
 
SUB RunqueryWtime(Query2run as string)
DIM STime as long, ETime as long, Rslt as single
STime = timer
docmd.openquery Query2run
ETime = timer
Rslt = (ETime-STime)/100
MSGBOX "Total query run time (secs) is " & cstr(Rslt),,"Query Run Time"
end sub

Or at least something like that
Disclaimer - will not work crossing midnight (timer gets reset to zero at midnight).
 

Users who are viewing this thread

Back
Top Bottom