Progress Bar (1 Viewer)

darrinp64

New member
Local time
Today, 21:47
Joined
Nov 10, 2012
Messages
5
Hi everyone this is my first post so please excuse me..I am hoping that someone maybe able to help me. I have a form that tracks a order from when it is received until it is completed and dispatched . The order goes through 8 production Phases which means 8 different physical locations. The user at each location checks a tick box when it arrives and another when it leaves. I have created a progress bar which moves when a check box is ticked, so as to provide a visual representation of where an order is located at anytime. Which works brilliantly.
My challenge is this .. When I close the form and use the same search criteria to find the order again the progress bar has reset itself to zero.
Being a newbie at this game I would be very grateful if anyone could tell me where I am going wrong?
Thanks in advance kindest regards Darrinp64
 

mahenkj2

Registered User.
Local time
Today, 14:17
Joined
Apr 20, 2012
Messages
459
It may be helpful if you post what code you are using.
 

darrinp64

New member
Local time
Today, 21:47
Joined
Nov 10, 2012
Messages
5
Thanks mahenjk2 sorry its taken awhile to get back to you. Find below the code I am using.

Private Sub Customer_Services_IN_Click()
Dim i As Integer, x As Double
Dim num As Integer, start As Double

num = 1 'Number of records in the form'
x = 0 / num 'X is the width of the text box converted to twips'

For i = 1 To num

Progress.Width = i * x

Next i
End Sub

Thanks in advance for your help
 

MarkK

bit cruncher
Local time
Today, 01:47
Joined
Mar 17, 2004
Messages
8,178
That code only ever set Progress.Width equal to zero, which doesn't satisfy the 'works brilliantly' billing. Do you save the status of the record in the record?
 

mahenkj2

Registered User.
Local time
Today, 14:17
Joined
Apr 20, 2012
Messages
459
Till "Number of records in the form" does not change when you open the form, width should not change. So as lagbolt asked whether you are saving the checkbox status in tables. If not, then in the beginning always record count shall be fixed (0/1).
 

darrinp64

New member
Local time
Today, 21:47
Joined
Nov 10, 2012
Messages
5
Hi as I said, bit of a novice at this, and yes I am saving the check box status in a table.
I think I have a idea where I am going wrong with this. do I need to write a form load event perhaps?
 

mahenkj2

Registered User.
Local time
Today, 14:17
Joined
Apr 20, 2012
Messages
459
Most probably, Yes.

If possible, can you post a sample dB?
 

mahenkj2

Registered User.
Local time
Today, 14:17
Joined
Apr 20, 2012
Messages
459
You may need to check that when your form loads, do you have recordsource already in place. If record source is loaded later or if it is un bound form, in the beginning you always have record count to zero.

In case, you do not find, please post a sample dB.

best regards.
 

MarkK

bit cruncher
Local time
Today, 01:47
Joined
Mar 17, 2004
Messages
8,178
Check out the Current event of the form, which fires each time the form loads a new record. This is commonly where you set exactly this type of user interface element that depends on the data in the record. Assuming the loaded record has a status value between zero and eight, you could do something like ...
Code:
option compare database
option explicit

private const MAX_STATUS as long = 8
private const PRG_FULL_WIDTH as long = 1440

private sub form_current()
    me.progress.width = PRG_FULL_WIDTH * me.status / MAX_STATUS
end sub
Does that make sense?
 

darrinp64

New member
Local time
Today, 21:47
Joined
Nov 10, 2012
Messages
5
Hi opening you both had a merry christmas and happy new year. I thought that I would include the entire code I have written for this form as you both maybe able to see what I can't. Thanks and very much appreciated.

Private Sub Customer_Services_IN_Click()
Dim i As Integer, x As Double
Dim num As Integer, start As Double
num = 1 'Number of records in the form'
x = 0 / num 'X is the width of the text box converted to twips'
For i = 1 To num
Progress.Width = i * x
Next i
End Sub

Private Sub Customer_Services_OUT_Click()
Dim i As Integer, x As Double
Dim num As Integer, start As Double
num = 1
x = 1133 / num '2cm'
For i = 1 To num
Progress.Width = i * x
Next i
End Sub

Private Sub Graphics_IN_Click()
Dim i As Integer, x As Double
Dim num As Integer, start As Double
num = 1
x = 2267 / num '4cm'
For i = 1 To num
Progress.Width = i * x
Next i
End Sub

Private Sub Graphics_OUT_Click()
Dim i As Integer, x As Double
Dim num As Integer, start As Double
num = 1
x = 3401 / num '6cm'
For i = 1 To num
Progress.Width = i * x
Next i
End Sub

Private Sub Proofing_IN_Click()
Dim i As Integer, x As Double
Dim num As Integer, start As Double
num = 1
x = 4535 / num '8cm'
For i = 1 To num
Progress.Width = i * x
Next i
End Sub

Private Sub Proofing_OUT_Click()
Dim i As Integer, x As Double
Dim num As Integer, start As Double
num = 1
x = 5669 / num '10'
For i = 1 To num
Progress.Width = i * x
Next i
End Sub

Private Sub Production_IN_Click()
Dim i As Integer, x As Double
Dim num As Integer, start As Double
num = 1
x = 6803 / num '12cm'
For i = 1 To num
Progress.Width = i * x
Next i
End Sub

Private Sub Production_OUT_Click()
Dim i As Integer, x As Double
Dim num As Integer, start As Double
num = 1
x = 7937 / num '14cm'
For i = 1 To num
Progress.Width = i * x
Next i
End Sub

Private Sub Assembly_IN_Click()
Dim i As Integer, x As Double
Dim num As Integer, start As Double
num = 1
x = 9070 / num '16cm'
For i = 1 To num
Progress.Width = i * x
Next i
End Sub

Private Sub Assembly_OUT_Click()
Dim i As Integer, x As Double
Dim num As Integer, start As Double
num = 1
x = 10204 / num '18cm'
For i = 11 To num
Progress.Width = i * x
Next i
End Sub
 

MarkK

bit cruncher
Local time
Today, 01:47
Joined
Mar 17, 2004
Messages
8,178
You need to set the progress bar when you load a record, correct, so when the form opens, for instance? And don't you need to set the progress bar each time you navigate to a new record?

In that case you need to develop a scheme to set the progress bar completely independently of any button click.

Do you understand the points I made in post #9?
 

Users who are viewing this thread

Top Bottom