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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time a query without opening it...

Status
Not open for further replies.

prover

Programmer
Joined
Sep 12, 2001
Messages
54
Location
US
Anyone know how to get the elasped time it took for a query to run without opening it? I have code that does this but the query needs to be opened.
 
prover,
You'd need to be more specific as to what 'run' means, also, is it a Select, Update, Delete, Append?

When you 'open' it, ie hit the red ! on the menu bar, I guess you're running it, but you're just returning (if it's a Select) the first few rows. The *true* measure is to hit the >| button in the navigation bar at the bottom of the grid, and wait till it hits the last record.

You could open the query as a recordset in code, then do a movelast, the results should be similar as opening in a window. But remember you're comparing apples to oranges, since posting graphic updates to the query grid is slower than just doing a movelast in code.

For an Action query, it's very difficult to do this without running it--since if you run it with the Use Transaction property=No, or SetWarnings = False, it runs faster since you don't get a chance to Undo it and it's not saving Undo transaction information, whereas if you run it and wait for the Are You Sure? prompt, then say 'No', that's really not the same as actually doing the update, since it was saving undo information in case you do say 'No'.

So now that I've really muddied the waters...the *true* answer is No, but the answer that will probably work in most cases is Yes--open a recordset over the query in code.
--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top