"Stopwatch" with a precision of milliseconds

Hi,

Is it possible to set up a "stopwatch" with a precision of milliseconds? I'm trying to find the bottle necks in my applications and for that I need something better than Now() which gives me only seconds.

Basically I want to put something like this at various places in my code to find out which bits take the most time:   Debug.Print "Time check 5: " & NowInMilliseconds()

If you know of a performance profiling tool for Access it would even be better, but I don't think one exists.

regards,
Michiel
altiplanoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim P.Commented:
Try Timer.
-=-----------------------------
Timer Function

Returns a Single representing the number of seconds elapsed since midnight.

In Microsoft Windows the Timer function returns fractional portions of a second. On the Macintosh, timer resolution is one second.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Here's some code that grabs hundreths of a second off NT:

http://www.mvps.org/access/api/api0039.htm

JimD
0
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:

  Another method is the GetTickCount() API, which grabs the CPU tick count.  It is in milliseconds.

JimD.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

altiplanoAuthor Commented:
I stand corrected, apparently there is a VBA code profiler: http://www.bandwood.com/vbacp.htm

It looks promising, but I can't get it running as it throws me a couple of " Undefined variable" errors. Probably my bad, so I've sent them a mail for help, but I'll have to wait until they wake up in Australia :-)

Meanwhile I'll try your suggestions.

Michiel
0
altiplanoAuthor Commented:
Thanks jimpen, I assumed Timer only returned whole seconds, so I didn't look into it any further.

The GetTickCount API also works, but Timer is just more elegant :-)

regards,
Michiel
0
Jim P.Commented:
Glad to be of assistance. May all your days get brighter and brighter.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.