[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

"Stopwatch" with a precision of milliseconds

Posted on 2008-02-05
6
Medium Priority
?
914 Views
Last Modified: 2010-06-09
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
0
Comment
Question by:altiplano
  • 2
  • 2
  • 2
6 Comments
 
LVL 38

Accepted Solution

by:
Jim P. earned 500 total points
ID: 20823279
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
 
LVL 59
ID: 20823346
Here's some code that grabs hundreths of a second off NT:

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

JimD
0
 
LVL 59
ID: 20823398

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

JimD.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 

Author Comment

by:altiplano
ID: 20823725
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
 

Author Comment

by:altiplano
ID: 20824181
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
 
LVL 38

Expert Comment

by:Jim P.
ID: 20824219
Glad to be of assistance. May all your days get brighter and brighter.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

590 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question