Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Posts
    4

    Unanswered: Show Progress Bar Whilst Running A Long Macro

    I have created a progress bar but want it to show the progress of a my Autoexec macro that takes quite a while to run. How do i do it?

  2. #2
    Join Date
    Feb 2004
    Location
    Dorset UK
    Posts
    147
    Is your progress bar in a form or is it the progressbar that appears on the bottom left of Access?

    Ken.

  3. #3
    Join Date
    Mar 2004
    Posts
    4
    The progress bar is in the Form. I would like the command button to run the Macro (Autoexec) and then the progress bar to show progress of Autoexec

  4. #4
    Join Date
    Feb 2004
    Location
    Dorset UK
    Posts
    147
    Ok Here is Code to get the Form displayed and updated


    Sub Display_Splash()

    DoCmd.OpenForm "Frm_Splash_KH", , , stLinkCriteria

    Forms!frm_splash_KH.display_label.Caption = Splash_Text

    Forms!frm_splash_KH.Progress.Value = 0

    Forms!frm_splash_KH.Refresh
    End Sub



    Sub Update_Splash()

    Forms!frm_splash_KH.display_label.Caption = Splash_Text

    DoEvents

    End Sub


    These two bits of code, will display and update your form

    This is a piece I wrote for you that has a simple loop


    Sub Your_Program()

    Display_Splash

    Splash_Text = "Some text..": Update_Splash

    Forms!frm_splash_KH.Progress.Max = 100

    For A = 1 To 100
    Forms!frm_splash_KH.Progress.Value = A: Update_Splash
    Next

    DoCmd.Close acForm, "frm_splash_KH", acSaveNo

    End Sub


    It calls the form, and updates it. You might have to canablise the code, if you are using a macro, personally I would write code, and even incorporate your macro in it.

    You could also consider using the standard progress bar on the bottom left. To call functions here use this:



    Sub Progress()

    MsgBox "Go"
    z = SysCmd(1, "Ken was here!!", 1000)

    z = SysCmd(2, 250)
    MsgBox "Almost"

    z = SysCmd(3)

    End Sub


    Does any of that help ??

    Ken

  5. #5
    Join Date
    Feb 2004
    Location
    Dorset UK
    Posts
    147
    If you are insisting that it must be a macro then you will have to do something like


    Action = openform (your form)

    If you have a label you want to update on that form then you could do this:

    setvalue
    item [Forms]![your_form]![you_label].[Caption]
    expression "your text"

    setvalue
    item [Forms]![your_form]![progressbar].[max]
    expression 100

    setvalue
    item [Forms]![your_form]![progressbar].[value]
    expression 10

    setvalue
    item [Forms]![your_form]![progressbar].[value]
    expression 20

    setvalue
    item [Forms]![your_form]![progressbar].[value]
    expression 30


    and so on...

    then finish with

    close
    object type Form
    object name Your_Form
    save No


    But its a Huge pain in the butt...



    Ken

  6. #6
    Join Date
    Mar 2004
    Posts
    4
    Many thanks, shall have a look at it this evening

    Originally posted by Ken_Hart
    If you are insisting that it must be a macro then you will have to do something like


    Action = openform (your form)

    If you have a label you want to update on that form then you could do this:

    setvalue
    item [Forms]![your_form]![you_label].[Caption]
    expression "your text"

    setvalue
    item [Forms]![your_form]![progressbar].[max]
    expression 100

    setvalue
    item [Forms]![your_form]![progressbar].[value]
    expression 10

    setvalue
    item [Forms]![your_form]![progressbar].[value]
    expression 20

    setvalue
    item [Forms]![your_form]![progressbar].[value]
    expression 30


    and so on...

    then finish with

    close
    object type Form
    object name Your_Form
    save No


    But its a Huge pain in the butt...



    Ken

Posting Permissions

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