INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Debug.print time between functions?

Debug.print time between functions?

(OP)
I have some functions, on certain forms in an application, which take a while to run. I want to set up some simple debug.print messages to capture the time I start the function, and the time I start and finish each step of the function. This way, I can isolate which step is taking the longest and work to improve that lag.

Make sense? Anyone know a quick and easy way to do this. From my main menu, one form I go to is an "add/find" form, which has to load the rowsource for 2 queries, after running a stored proc to reset the flags in their underlying table. Just wanting to figure out what part of that is the slowest part, and see what I can do to speed it up. Thanks!

misscrf

It is never too late to become what you could have been ~ George Eliot

RE: Debug.print time between functions?

In your vba, did you try putting Debug.Print "YourFunctionName Started at: " & Now
and Debug.Print "YourFunctionName Completed at: " & Now
before and after each command or function? Or is there something more complicated that I'm missing? (Changing "yourfunctionname" to the actual name of the item you plan to check the time on.

RE: Debug.print time between functions?

(OP)
No, you got it. I ended up realizing I could do the same, I just formatted it differently.

CODE

Debug.Print "Start doing step N"
Debug.Print Format(Now(), "hh-mm-ss")

blah blah step n

Debug.Print "finish doing step N"
Debug.Print Format(Now(), "hh-mm-ss") 

Thanks!

misscrf

It is never too late to become what you could have been ~ George Eliot

RE: Debug.print time between functions?

You may also do:

CODE

Dim dat As Date

dat = Now()
'... blah blah step N
Debug.Print "Step N took " & DateDiff("s", dat, Now()) & " seconds"
dat = Now()
'... blah blah step X
Debug.Print "Step X took " & DateDiff("s", dat, Now()) & " seconds" 

Lazy approach, I don't want to calculate the difference in my head.... smile

---- Andy

There is a great need for a sarcasm font.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close