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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Indicate percentage completion on progress bar

Status
Not open for further replies.

3pmilk

MIS
Jun 20, 2002
46
US
Hi all,

I have a progress bar and I want to show users the percentage completion process when executing sql and generating a report. The following code snippet is consists of a function that indicates percentage completion and a procedure that calls the function. However, I'm getting object defined error or application error on this offending line frm.Increfrmnt sPercentage, sStatus.

Any ideas?

Thanks so much for your help.



Option Explicit
Dim frm As Form


Private Sub BellListView_Click()

Dim Index As Integer
Dim Currid As String
Dim PB As Control

Dim sPercentage As Single
Dim sStatus As String

Dim alistitem As ListItem
For Index = 1 To BellListView.ListItems.Count
Set frm = Forms!RCD
Set PB = frm!ProgressBar6
frm.Repaint
PB.Max = BellListView.ListItems.Count

sPercentage = (Index / BellListView.ListItems.Count) * 100
sStatus = "Checking " & Index
frm.Increfrmnt sPercentage, sStatus
sPercentage = (Index / PB.Max) * 100
sStatus = "Checking " & Index

Set alistitem = BellListView.ListItems(Index)
If (alistitem.Selected = True) Then
Currid = BellListView.ListItems(Index).Text

frm.Increment sPercentage, sStatus
MsgBox Currid
Exit For
End If
Next Index


DoCmd.Close acForm, "frmProgress6"
Set PB = Nothing
Set frm = Nothing

End Sub


Private Sub UserForm_Initialize()
frm.Caption = "0% Complete"
End Sub

Public Function Increment(sPercentComplete As Single, _
sDescription As String)

frm.Label10.Caption = sDescription
frm.Repaint
Dim iPercentIncrefrmnt As Integer
iPercentIncrefrmnt = Format(sPercentComplete, "#")

Select Case iPercentIncrefrmnt
Case 10
frm.Frafrm1.Visible = True
frm.Caption = "10% Complete"
frm.Repaint
Case 20
frm.Frafrm2.Visible = True
frm.Caption = "20% Complete"
frm.Repaint
Case 30
frm.Frafrm3.Visible = True
frm.Caption = "30% Complete"
frm.Repaint
Case 40
frm.Frafrm4.Visible = True
frm.Caption = "40% Complete"
frm.Repaint
Case 50
frm.Frafrm5.Visible = True
frm.Caption = "50% Complete"
frm.Repaint
Case 60
frm.Frafrm6.Visible = True
frm.Caption = "60% Complete"
frm.Repaint
Case 70
frm.Frafrm7.Visible = True
frm.Caption = "70% Complete"
frm.Repaint
Case 80
frm.Frafrm8.Visible = True
frm.Caption = "80% Complete"
frm.Repaint
Case 90
frm.Frafrm9.Visible = True
frm.Caption = "90% Complete"
frm.Repaint
Case 100
frm.Frafrm10.Visible = True
frm.Caption = "100% Complete"
frm.Repaint
End Select
End Function
 
How are ya 3pmilk . . .

Your certainly incrementing the [blue]percentage[/blue] but [blue]your not incrementing the bar![/blue]

Calvin.gif
See Ya! . . . . . .
 
...and, you're not call the function correctly!

frm.Increment sPercentage, sStatus
Is an invalid property (at least your syntax implies,
a form property)

an idea...

add another argument to Increment()

Public Function Increment(sPercentComplete As Single, _
sDescription As String, frm As Access.Form)

Call like this...

Call Increment (sPercentage, sStatus, frm)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top