Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2005
    Posts
    4

    Unanswered: total run-time in Status Bar?

    Is there a way to show the total time the following code took to execute (from beginning to end) in the status bar? Please don't laugh at my VBA, I am a complete beginner.



    Function Dataprep()

    Dim start As Long

    On Error GoTo Dataprep_Err

    DoCmd.SetWarnings False
    StsBar = SysCmd(acSysCmdClearStatus)

    DoCmd.OpenQuery "z01", acNormal, acEdit
    StsBar = SysCmd(acSysCmdSetStatus, "Step 1 of 3 Complete")

    start = Timer
    Do While Timer < (start + 3)
    Loop
    StsBar = SysCmd(acSysCmdClearStatus)

    DoCmd.OpenQuery "z02", acNormal, acEdit
    StsBar = SysCmd(acSysCmdSetStatus, "Step 2 of 3 Complete")

    start = Timer
    Do While Timer < (start + 3)
    Loop
    StsBar = SysCmd(acSysCmdClearStatus)

    DoCmd.OpenQuery "z03", acNormal, acEdit
    StsBar = SysCmd(acSysCmdSetStatus, "All Steps Complete")

    start = Timer
    Do While Timer < (start + 3)
    Loop
    StsBar = SysCmd(acSysCmdClearStatus)

    DoCmd.SetWarnings True

    Dataprep_Exit:
    Exit Function

    Dataprep_Err:
    MsgBox Error$
    Resume Dataprep_Exit

    End Function

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Are you just trying to find the total time it took to open 3 queries?
    It looks like you like you have the syntax down for displaying stuff in the
    status bar.

    If you set a date variable to the current date/time at the beginning of the
    functuion using:

    dtmStart = Now()

    and then after the queries have run figure out your total time using

    sinTtlTime = datdiff("s", dtmStart, Now())
    StsBar = SysCmd(acSysCmdSetStatus, "Process took" & sinTtlTime & " seconds")
    Inspiration Through Fermentation

  3. #3
    Join Date
    Feb 2005
    Posts
    4
    Exactly what I was looking for. Thank you much!

  4. #4
    Join Date
    Feb 2005
    Posts
    333
    Are there any referneces that list all the system commands like acSysCmdSetStatus?

  5. #5
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    I found it in the online help screen (Access XP), by going into
    help from a module, and typing in SYSCMD. At some point in
    the screen that comes up, you'll see "AcSysCmdAction",
    click on that and it will show the entire list of actions available to SysCmd.
    Inspiration Through Fermentation

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •