I am in the middle of creating a booking system. At the moment, I have 2 combo boxes, one for the start time, which in this case is just from 9 to 17, and an option for the length of the lesson, from 1 to 3. What I am trying to accomplish is the following.

If a user selects any start time below 17 (i.e. 16,15, only hourly slots are avaliable) then the combo box for length will display 1, 2 or 3 hours. If they choose 16, then only 1 or 2 hours can be chosen in length as the store closes at 18:00. If 17 is chosen, the combo box should only be populated with 1 hour option.

I have put the code in the combo box Length click event, so when they click on the combo box, the IF statements are conducted, and the box is populated with such and such.

Once the start time and end time are chosen, tStart and tLength respectively, the two integers are added, to produce fTime, which will populate a text box.

However, its not working. Every option selected for the start time, still shows all 1, 2 and 3 hour options in the cmbLength box. Am I using the wrong event, I have also tried it with _change. Any advice is much appreciated.

Code:
Dim tStart As Integer
Dim tLength As Integer
Dim fTime As Integer

Private Sub cmbLength_Click()

tStart = cmbStart.Text
tLength = cmbLength.Text

If tStart = 17 Then
    cmbLength.Clear
    cmbLength.AddItem "1"
ElseIf tStart = 16 Then
    cmbLength.Clear
    For Counter = 1 To 2
        cmbLength.AddItem Counter
    Next Counter
ElseIf tStart < 16 Then
    cmbLength.Clear
    For Counter = 1 To 3
        cmbLength.AddItem Counter
    Next Counter
End If

fTime = tStart + tLength
txtEnd.Text = fTime

End Sub

Private Sub Form_Load()

For Counter = 9 To 17
    cmbStart.AddItem Counter
Next Counter

For Counter = 1 To 3
    cmbLength.AddItem Counter
Next Counter

End Sub