I have used the following code to make visible or make unvisible certain labels and text boxes based on the selection from a combo box. The problem is when I go to the next record the labels and text boxes showing are those that were selected to be visible based on the choice made on the previous records combo box. For example if on the first record cboInserts is selected as 2 then Insert_Type2, Insert_Serial2, InsertLabel2 and InsertLabel5 are set as visible. When I go to the next record cboInserts is selected as 1 so these should not be visible but they are now. Any help would be greatly appreciated. Thank you in advance!
Private Sub cboInserts_AfterUpdate()
If Me.cboInserts.Value >= 1 Then
Me.Insert_Type1.Visible = True
Me.Insert_Serial1.Visible = True
Me.InsertLabel1.Visible = True
Me.InsertLabel4.Visible = True
Else
Me.Insert_Type1.Visible = False
Me.Insert_Serial1.Visible = False
Me.InsertLabel1.Visible = False
Me.InsertLabel4.Visible = False
End If
If Me.cboInserts.Value >= 2 Then
Me.Insert_Type2.Visible = True
Me.Insert_Serial2.Visible = True
Me.InsertLabel2.Visible = True
Me.InsertLabel5.Visible = True
Else
Me.Insert_Type2.Visible = False
Me.Insert_Serial2.Visible = False
Me.InsertLabel2.Visible = False
Me.InsertLabel5.Visible = False
End If
If Me.cboInserts.Value >= 3 Then
Me.Insert_Type3.Visible = True
Me.Insert_Serial3.Visible = True
Me.InsertLabel3.Visible = True
Me.InsertLabel6.Visible = True
Else
Me.Insert_Type3.Visible = False
Me.Insert_Serial3.Visible = False
Me.InsertLabel3.Visible = False
Me.InsertLabel6.Visible = False
End If
End Sub