Hi,
I am opening a recordset to read booking times, converting them to twips and storing them in array to display some boxes that represent a timescale.
My current method used below, will display just six boxes.
How can i adapt this to display any number of boxes and of course, reduce the coding. (of course, I could continue to use my method, but not favourable)
I am wondering if I could use some kind of control method to reference the Boxes in this manner:
I am opening a recordset to read booking times, converting them to twips and storing them in array to display some boxes that represent a timescale.
My current method used below, will display just six boxes.
How can i adapt this to display any number of boxes and of course, reduce the coding. (of course, I could continue to use my method, but not favourable)
I am wondering if I could use some kind of control method to reference the Boxes in this manner:
Code:
"BOX" & A = .....
Code:
For A = 1 To NoofBookings
'MsgBox TimeSlot(A, 0) & " " & TimeSlot(A, 1) & " " & TimeSlot(A, 2) & " " & TimeSlot(A, 3)
Select Case A
Case 1
box1.Visible = True
box1.Left = ((((TimeSlot(A, 0) + (TimeSlot(A, 1) / 60) - 9) * 2) + LeftPos)) * tw
box1.Width = ((TimeSlot(A, 2) + (TimeSlot(A, 3) / 60))) * tw * 2
box1.Caption = TimeReg(A)
Case 2
Box2.Visible = True
Box2.Left = ((((TimeSlot(A, 0) + (TimeSlot(A, 1) / 60) - 9) * 2) + LeftPos)) * tw
Box2.Width = ((TimeSlot(A, 2) + (TimeSlot(A, 3) / 60))) * tw * 2
Box2.Caption = TimeReg(A)
Case 3
Box3.Visible = True
Box3.Left = ((((TimeSlot(A, 0) + (TimeSlot(A, 1) / 60) - 9) * 2) + LeftPos)) * tw
Box3.Width = ((TimeSlot(A, 2) + (TimeSlot(A, 3) / 60))) * tw * 2
Box3.Caption = TimeReg(A)
Case 4
Box4.Visible = True
Box4.Left = ((((TimeSlot(A, 0) + (TimeSlot(A, 1) / 60) - 9) * 2) + LeftPos)) * tw
Box4.Width = ((TimeSlot(A, 2) + (TimeSlot(A, 3) / 60))) * tw * 2
Box4.Caption = TimeReg(A)
Case 5
Box5.Visible = True
Box5.Left = ((((TimeSlot(A, 0) + (TimeSlot(A, 1) / 60) - 9) * 2) + LeftPos)) * tw
Box5.Width = ((TimeSlot(A, 2) + (TimeSlot(A, 3) / 60))) * tw * 2
Box5.Caption = TimeReg(A)
Case 6
Box6.Visible = True
Box6.Left = ((TimeSlot(A, 0) + (TimeSlot(A, 1) / 60) - 9 + LeftPos)) * tw
Box6.Width = ((TimeSlot(A, 2) + (TimeSlot(A, 3) / 60))) * tw * 2
Box6.Caption = TimeReg(A)
End Select
Next A
Comment