I want to be able to open a form "Customers", but as it is opening I want to display a progress meter (lots of data to load). The source code for the progress meter is below, however, I do not know how to modify the code so as to function properly. Need help...
Private Sub Read_Click()
Me.Status.Caption = "Reading"
Screen.MousePointer = 11
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim Counter As Long
Set db = CurrentDb
Set rs = db.OpenRecordset("Customers", dbOpenSnapshot)
rs.MoveFirst
While Not rs.EOF
CurrentRecordID = rs!CustomerID
ProgressBarB.Width = (ProgressBarA.Width / rs.RecordCount) * rs.AbsolutePosition
Me.Repaint
rs.MoveNext
For Counter = 1 To 750000: Next
Wend
If rs.EOF Then
ProgressBarB.Width = rs.RecordCount
Me.Repaint
CurrentRecordID = ""
Me.Status.Caption = "Done"
ProgressBarB.Width = 0
Me.Repaint
End If
rs.Close
Set rs = Nothing
Set db = Nothing
Screen.MousePointer = 0
End Sub
Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.
So, what is the code doing? Giving an error? Hanging? Nothing at all?
First thing that caught my eye was this line:
For Counter = 1 To 750000: Next
Why do you need a counter. From what I can see this line doesn't do anything for you. In addition, are you using the Progress Bar ocx control or some other control?
The code above works just fine. But, it is triggered from a command button "Read" on a form named "Progress Meter Form". What I need to be able to do is trigger the "Progress Meter Form" from the command button that is opening the form "Customers"...
then when finished, restore window (DoCmd.Restore I think it is)
what you could do though perhaps, if above dont work, is use the timer of the customers form to display your progress bar instead of having a seperate form
0
CatDaddy2003Author Commented:
How do I use the "Timer to display the progress bar" instead of having a separate form?
min would be 1
max would be recordcount
when updating progressbar,you dont change the width but the value
e.g.
progressbar.min=1
rs.MoveLast
progressbar.max= rs.Recordcount
rs.MoveFirst
then in code do this
progressbar.value = ....