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!

MS ProgressBar ver. 6.0...how to make it work? 2

Status
Not open for further replies.

gusbrunston

Programmer
Feb 27, 2001
1,234
US
[tt]
Hi:

I'd like to implement the ActiveX control, Microsoft ProgressBar Version 6.0.

Problem is, when I open the form to set the properties, I have no clue.

Is there someone familiar with ActiveX and particularly this control could point me on the right path?

Thanks in advance.[/tt] Gus Brunston [glasses] An old PICKer, using Access2000
[tt]Want solutions you can understand?
Post understandable questions.
[/tt]
 
All the action takes place in the last 8 lines of the properties dialog box.

Set Min and Max to appropriate values ( at design time or in VBCode at run time. ) Then set Scrolling to Smooth for linear progress or set it to Standard for clunky chunky steps.

Then as your process progresses set the control name equal to the value that you want to monitor progress of.

As a demo try this

On the form place Text box control called "Text1"
and Progress box called "ActiveXCtl0"

Private Sub Form_Open(Cancel As Integer)
Text1 = 1
End Sub

Private Sub Form_Timer()
Text1 = Text1 + 1
ActiveXCtl0 = Text1
End Sub

Set the form's Timer interval to 1000 ( 1 Second )
Set the Progress bar properties to:-
Min = 0
Max = 60
Scrolling = Smooth

Run and watch.



'ope-that-'elps.







G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.
 
The progress bar has a value of 0 to 100. Zero is an empty progress bar and 100 is a full or complete progress bar. (progressbar.value = 0)

The only reason you would use a progress bar is to give the user some idea of how long the process he or she will run will take.

Let's say you are running a set of docmd.openquery statements.. twelve of them. You really have no idea how long each query will take.. but you can change the value of the progress bar each time the docmd.openquery statement is complete (100/8 = 12.5). Update the progress bar by 12.5 each time the bar is complete.

Now, if you are looping through a recordset in code then your progress bar will be much more accurate. Devide the recordset by 100 and then add that value to the bar each time you loop. Example:

bar.Visible = True
bar.Value = 0

RS.MoveLast
RS.MoveFirst

loopcount = rs.recordcount
loopvalue = loopcount / 100

With RS

While Not RS.EOF
bar.Value = bar.Value + loopvalue
.movenext
Wend

End With
 
Many thanks to OnClickLCC- I have just found this and it was just what I needed, now working perfectly.

Only comment is an error in the loopvalue calc- should be 100/loopcount, not the other way around.

Thanks again Nigel
Didn't someone say work is supposed to be fun? They didn't have computers then I guess....
 
Hello,
I'm currently working on MSProgresscontrol 5.0 and 6.0. I have a user, who just got a new laptop. When I install Access, MSProgress 5.0 doesnt appear, but ProgressBar control does. I'm getting this error message when the user logs into the database: run-time error 2763, ProgressBar Control returned the error: Invalid Property value.

Seemed like this would be a good place to ask this question based on what I just read...Here is the code
Private Sub Form_Timer()
(the code below was highlighted in debug mode)
Me.ctlProgress.Value = 5

Any suggestions or advice? I already posted this early, but when I read this I thought this would be the place to get some answers...

Thanks,
Clark
Honda of America,
 
Hi Clark

This will probably be a library reference problem.

Go to Tools, References from the code window and make sure the same libraries are checked on the laptop as on you own machine. I'm afraid I don't know which one off the top of my head is responsible for the progress bar, but if you match what you have that should do it....

HTH Nigel
Didn't someone say work is supposed to be fun? They didn't have computers then I guess....
 
[tt]
Hi:

Thanks to everyone who answered my question. I have been and will be tied up with other obligations for a few days, so I can't get with this particular project, but I didn't want anyone to think I wasn't grateful.

Thanks! Gus Brunston [glasses] An old PICKer, using Access2000
[tt]Want solutions you can understand?
Post understandable questions.
[/tt]
 
Thanks for the suggestion, I'll see what happens...

Clark
 
Why not use the reference percentposition instead of trying to calculate the number of records etc?
 
Whoops, hit send too soon!


ie

bar.visible = true
bar.value = 0

..


rs.movenext

bar.value = rs.percentposition


Set the property to smooth scrolling and it looks really good!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top