Progress bar freezes when table is too large

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RichardS34
    New Member
    • Jul 2015
    • 1

    #1

    Progress bar freezes when table is too large

    This is Access 2010, Windows8.1. I made a text box progress bar on a form that widens as the records move to the next one. The progress bar works fine with 600 records and freezes with about 900 or less records. (Those are my test records.) My full table is over 9,000 records and the bar (and record bar that shows each record being processed) freezes for over a minute, then suddenly the progress completes and the bar goes to the end and the record bar also shows the end count. In effect, Access freezes for the period of time needed to complete moving through the records. What I need is for the same gradual progress bar widening to show the program is still working. Records are being processed, but the progress does not show because the visual part of the process stops somehow. Would appreciate any ideas what is going on and possible alternatives. Right now, I'm just trying to set up the progress bar that works with any number of records.

    Code for the progress bar-
    Code:
    While CurrentRecord < RecordCount
    
     Counter = Counter + 1
      If (Counter = Blocks) Then
             
         If (Percent = 1) Then
                    FormProgressBarContinuous.Text26.Width = 100
                ElseIf (Percent = 2) Then
                    FormProgressBarContinuous.Text26.Width = 400
                ElseIf (Percent = 3) Then
                    FormProgressBarContinuous.Text26.Width = 700
                ElseIf (Percent = 4) Then
                   FormProgressBarContinuous.Text26.Width = 1000
                ElseIf (Percent = 5) Then
                   FormProgressBarContinuous.Text26.Width = 1300
                ElseIf (Percent = 6) Then
                   FormProgressBarContinuous.Text26.Width = 1600
                ElseIf (Percent = 7) Then
                   FormProgressBarContinuous.Text26.Width = 1900
                ElseIf (Percent = 8) Then
                   FormProgressBarContinuous.Text26.Width = 2200
                ElseIf (Percent = 9) Then
                   FormProgressBarContinuous.Text26.Width = 3000
                End If
                
              Percent = Percent + 1
              Blocks = Blocks + MinBlock
              
            End If
        
        DoCmd.GoToRecord , , acNext
    Wend
    Last edited by Rabbit; Jul 20 '15, 06:14 AM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • jimatqsi
    Moderator Top Contributor
    • Oct 2006
    • 1293

    #2
    You might get what you want by adding a DoEvents at the bottom of the loop.

    But i would get rid of all the If / Elseif and use instead
    Code:
    FormProgressBarContinuous.Text26.Width=Percent * maximumWidth/100
    to automatically set the size of the progress bar. You will have to plug in what the maximum width is. It should 1440 * the number of inches wide the bar is.

    Also, see my article http://bytes.com/topic/access/answer...t-progress-bar.

    Jim

    Comment

    Working...