Progress bar: Error Help

Thorope

New member
Local time
Today, 03:24
Joined
Nov 16, 2010
Messages
7
Hey, i have been getting this error for some time now, i know there is lots of threads giving Information on it but it doesn't help me with my problem, The Error is, Sub or Function Not defined, i have coloured it where it lights up, here is the code.

Code:
Option Compare Database
Option Explicit

Private Sub Form_Open(Cancel As Integer)
DoCmd.SetWarnings False


'+500 each time

Perbox.Width = 0
ProgressText.Value = "0%"
DoEvents

Me.TimerInterval = 1000
End Sub
-----------------------------
[COLOR="Yellow"]Public Function ProgressBar()[/COLOR]

Perbox.Width = 500
ProgressText.Value = "10%"
Pause (1)

Perbox.Width = 1000
ProgressText.Value = "20%"
Pause (1)


Perbox.Width = 1500
ProgressText.Value = "30%"
Pause (1)


Perbox.Width = 2000
ProgressText.Value = "40%"
Pause (1)


Perbox.Width = 2500
ProgressText.Value = "50%"
Pause (1)


Perbox.Width = 3000
ProgressText.Value = "60%"
Pause (1)


Perbox.Width = 3500
ProgressText.Value = "70%"
Pause (1)


Perbox.Width = 4000
ProgressText.Value = "80%"
Pause (1)

Perbox.Width = 4500
ProgressText.Value = "90%"
Pause (1)


Perbox.Width = 5500
ProgressText.Value = "100%"
Pause (1)

DoCmd.Beep
DoCmd.OpenForm "Menu Screen Admin"
DoCmd.Close

End Function
---------------------------------------------
Private Sub Form_Timer()

    Call ProgressBar
    
End Sub

I know this is most probably a nooby way of doing it, but i am rather new to VB as im doing the IT Diploma and i find VB very useful and fun,

hope you can help. :D
 
Ya, i saw that video, it was a great help, but the thing is i don't want it to be in blocks, i wanted it to be just 1 block that moves from 1 to 100 if you know what i mean, like when you install games.
 
I know what you mean, but Access is single threaded and you won't make a separate Progressbar and display it, while your query/routine is running.
The best you can do, from what I have found, is to use a rectangle inside a rectangle approach and use DoEvents when you want to get a new value for your "progressing" rectangle.

Here is another link that may be of use.
http://www.granite.ab.ca/access/progressbar.htm


Also, you don't have to use multiple smaller rectangles. You could have one that changes its width. It would just look like it's moving/progressing.
 
Thats what i have done in the code above, PerBox is a box that changes width but i keep getting tht error
 
Never mind then, ill just do a block one, thanks for the help anyway. :D
 
Thorope,

Attached is an mdb in Acc2000 format. It has a table Customers with data from the NorthWind database (90 records or so). It has a form with a Progress bar.

I got parts of this from various people over the years.

Open the form and read the Status.
Then click the READ button to see the progress bar effect.

There is code behind the Read button.

Depending on your processor speed, you can look at the code behind the form and adjust the For loop. Try adding another 0 (7500000) and watch the affect.

Good luck.
 

Attachments

Last edited:

Users who are viewing this thread

Back
Top Bottom