Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

progress bar 2

Status
Not open for further replies.

GLENEE

Programmer
Feb 9, 2005
64
GB
Can anyone help me in using the Access ProgressBar. I want it to display while adding record from one recordset to another(approx 750000 records). It seems to start then stops moving, an example of code is shown below:
Do While rstTempF.EOF = False
'start progress bar
Forms!frmProgress.ProgressBar3 = rstTempF.PercentPosition
Forms!frmProgress.Repaint
With rstTempT
.AddNew
!intInvoiceNo = rstTempF("invno")
!txtUSI = Left(rstTempF("usi"), 12)
!txtPayUIN = Left(rstTempF("payuin"), 6)
!txtOrderUIN = Left(rstTempF("orduin"), 6)
!txtSiteID = Left(rstTempF("siteid"), 6)
!txtFSI = Left(rstTempF("fsi1"), 25)
!dteDateFrom = rstTempF("datefrom")
!dteDateTo = rstTempF("dateto")
!txtServiceCode = Left(rstTempF("svcecode"), 6)
!txtServiceDescription = Left(rstTempF("description"), 100)
!curCharge = rstTempF("charge")
!txtFeatureDescription = Left(rstTempF("f2"), 20)
.Update
End With
rstTempF.MoveNext
Loop
 
maybe add a doEvents in the loop somewhere?

--------------------
Procrastinate Now!
 
How are ya GLENEE . . .

try this:
Code:
[blue]   [purple][b]Dim frm As Form, PB As Control
   
   Set frm = Forms!frmProgress
   Set PB = frm!ProgressBar3
   frm.Repaint
   rsttempF.MoveLast
   rsttempF.MoveFirst
   PB.Max = rsttempF.RecordCount[/b][/purple]
   
   Do While rsttempF.EOF = False
      With rstTempT
        .AddNew
        !intInvoiceNo = rsttempF("invno")
        !txtUSI = Left(rsttempF("usi"), 12)
        !txtPayUIN = Left(rsttempF("payuin"), 6)
        !txtOrderUIN = Left(rsttempF("orduin"), 6)
        !txtSiteID = Left(rsttempF("siteid"), 6)
        !txtFSI = Left(rsttempF("fsi1"), 25)
        !dteDateFrom = rsttempF("datefrom")
        !dteDateTo = rsttempF("dateto")
        !txtServiceCode = Left(rsttempF("svcecode"), 6)
        !txtServiceDescription = Left(rsttempF("description"), 100)
        !curCharge = rsttempF("charge")
        !txtFeatureDescription = Left(rsttempF("f2"), 20)
        .Update
      End With
      [purple][b]PB = PB + 1[/b][/purple] [green][b]'Increment the bar[/b][/green]
      rsttempF.MoveNext
   Loop

   [purple][b]DoCmd.Close acForm, "frmProgress"[/b][/purple]
   Set PB = Nothing
   Set frm = Nothing[/blue]

Calvin.gif
See Ya! . . . . . .
 
Try using this insted of your current repaint command:

docmd.RepaintObject acForm "MyForm
 
Thanks Aceman1, i wasn't incrementing the progress bar - doh! How would i display the position within the recordset e.g 3165 of 750000 etc as it is appending?
 
GLENEE . . .

I thought you would've pinned that one down . . .

Anyway two unbound textboxes, side by side. The one on the left gets updated with the count:
Code:
[blue]   PB = PB + 1
   Me![purple][b]LeftTextBoxName[/b][/purple] = PB
   rsttempF.MoveNext[/blue]
The one on the right get update with the recordcount:
Code:
[blue]   rsttempF.MoveLast
   rsttempF.MoveFirst
   PB.Max = rsttempF.RecordCount
   Me![purple][b]RightTextBoxName[/b][/purple] = "of" & PB.Max

   Do While rsttempF.EOF = False[/blue]

Calvin.gif
See Ya! . . . . . .
 
Howdy Zion7 . . .

Thanks . . . [blue]I do try![/blue]

[blue]I have to admit . . . its hard being one of the good guys![/blue] ;-)

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top