accessman2
10-12-2005, 10:28 AM
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.
accessman2
10-17-2005, 06:12 PM
How to do capture Timer?
Could you show the ways for me? Thanks a lot.
Ian Mac
10-17-2005, 06:22 PM
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).