Please Tell Me about the Progress Bar

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Wornout
    New Member
    • Oct 2013
    • 22

    Please Tell Me about the Progress Bar

    Original title :
    Thanks Rabbit and ZMBD, Please Tell me about progress bar

    I solved my last issues Thanks. I started again I think I was trying too much and got too bogged down, so started again and kept it tidy and clean.

    I would like to know about a progress bar. I have a parameter form with a button that you click and opens a report but the report takes a while to do all the calculations as there is a lot. You can see the report while it is doing this. I would like to put something on the screen to show progress or that the system is doing something.

    I dont want to just change the mouse pointer to an egg timer but would like a bar thing. I tried an ActiveX control but it did not show up on the report only in design view. I am not sure where to put it in the form under the button or on the report. I dont know weather the ActiveX one is best or VBA code(I try and find the code on line and copy and paste it). I am not sure if I make my own box and code that or put it in the report load event.

    I like the idea and would like to learn/use it. I am not that good with VBA but do give things a try. Can someone tell me about the progrss bar(Access 2007).
    Last edited by NeoPa; Nov 6 '13, 02:59 PM. Reason: Changed title and tidied up question to be more easily read.
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32634

    #2
    That's a nice concept Wornout, but we have standards that titles must conform to. I've updated it for you and put the thanks in your opening post instead.

    There are a number of threads on Bytes that deal with this issue :
    How to Use a Progress Meter in Access.
    Progress Indicator in Access.

    These are just two. Look them over and see which more closely fits your requirements then we can discuss how to help you if you need more help.

    Comment

    • topher23
      Recognized Expert New Member
      • Oct 2008
      • 234

      #3
      I've used the ActiveX progress bar in the past and found it to be useful, but it's a dependency that's unnecessary; it provides no actual additions to functionality. Instead, you could try something like this:

      Add a rectangular Box the size of the progress bar you want to see on the form you'd like it to appear on. We'll name this box boxProgressBarF rame. Give it a solid border and a transparent background. Then throw another box directly over this box, with either a transparent border or a border the same color as the frame, and a solid background. Name this box boxProgressBar. If you want to display a little message, like "Loading the report...", create a label with your text and call it lblProgressBar. Then use a function like this:

      Code:
      Public Function pfnProgressBar(ProgressPercent As Integer)
      'Code courtesy of Topher Ritchie
      'Free to use as part of an application
      'if this notice is left in place.
      Dim ControlSize As Long
          
          ControlSize = 2 * 1440 'The progress bar is 2 inches on   
                                 'screen, multiplied by 1440 to get  
                                 'the number of "twips," the 
                                 'actual measurement unit used by 
                                 'MS Access
          With Forms!MyForm 'change this to your form name
              If ProgressPercent = 0 Then 
                  !lblProgressBar.Visible = False
                  !boxProgressBar.Visible = False
                  !boxProgressBarFrame.Visible = False
              Else
                  !lblProgressBar.Visible = True
                  !boxProgressBar.Visible = True
                  !boxProgressBarFrame.Visible = True
              End If
              If ProgressPercent > 100 Then ProgressPercent = 100
              !boxProgressBar.Width = (ProgressPercent / 100) * _
                    ControlSize
              .Repaint
          End With
          
      End Function
      So, you pass a "percentage " number like so:
      Code:
      pfnProgressBar 20
      and the progress bar moves to 20% completion. Obviously, this means you have to trap events and iterate your progress, so when the code is running it will keep updating. Passing
      Code:
      pfnProgressBar 0
      will make the progress bar and label invisible to the user.

      Let us know if this will work for you.
      Last edited by topher23; Nov 6 '13, 03:09 PM. Reason: sloppy spelling

      Comment

      • Wornout
        New Member
        • Oct 2013
        • 22

        #4
        Thanks NeoPa, I did not realize, I did do a search on here but did not really understand what I was meant to be doing and if it was even a good idea.Maybe cause it was getting late and my mind was getting tired and I was having trouble formatting some equations in a union query and getting frustrated with that.

        Comment

        • Wornout
          New Member
          • Oct 2013
          • 22

          #5
          Thank you Topher23 will give it a try,and let you know

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32634

            #6
            Doing a search, and finding what you want, are not always the same thing. No criticism implied because you don't have the tools available to you that I do. I keep notes of many of what I consider the most important and useful threads and posts. These are just two that I have in my database for whenever such questions come up.

            Comment

            • Wornout
              New Member
              • Oct 2013
              • 22

              #7
              Hi Topher23, I did as you said and copied and pasted what you wrote and changed the form to report name of report. but got lost when you said "So, you pass a "percentage " number like so: pfnProgressBar 20". The above code is not in an event attached to anything,I just opened my report in design view and up the top on the tool bar next to properties sheet I clicked on the VBA code symbol and put it there is that right?now I can at last see the bar but it does not move while the calculating is being done is that because I have not passed the % I am not sure where that goes or how,

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32634

                #8
                From time to time, in your code, you call it with different percentage values. Whatever value was passed last time you called it - will be what is displayed in the progress meter. Does that make it clearer for you?

                Comment

                Working...