Hi
I have a form with 4 combo boxes.
The code that I use works correctly when I first open the form. There after if the form remains open and I select new records the next cbo filters correctly but the subsequent cbo retains the previous record set until it's parent is selected.
The combos should be locked and cleared.
They do clear but don't lock (I think this is because there is a list from the previous record set).
All of the combo boxes are sourced through queries.
This is the code that I am using.
[Private Sub cboRep_AfterUpdate()
Me.cboCust.Requery
Me.cboCust.Locked = Me.cboCust.ListCount < 1
Me.cboCust.Enabled = Me.cboCust.ListCount > 0
Me.cboSite = ""
Me.cboSite.Requery
Me.cboSite.Locked = Me.cboSite.ListCount < 1
Me.cboSite.Enabled = Me.cboSite.ListCount > 0
Me.cboCont.Requery
Me.cboCont = ""
Me.cboCont.Locked = Me.cboCont.ListCount < 1
Me.cboCont.Enabled = Me.cboCont.ListCount > 0
End Sub]
Steven811
I have a form with 4 combo boxes.
The code that I use works correctly when I first open the form. There after if the form remains open and I select new records the next cbo filters correctly but the subsequent cbo retains the previous record set until it's parent is selected.
The combos should be locked and cleared.
They do clear but don't lock (I think this is because there is a list from the previous record set).
All of the combo boxes are sourced through queries.
This is the code that I am using.
[Private Sub cboRep_AfterUpdate()
Me.cboCust.Requery
Me.cboCust.Locked = Me.cboCust.ListCount < 1
Me.cboCust.Enabled = Me.cboCust.ListCount > 0
Me.cboSite = ""
Me.cboSite.Requery
Me.cboSite.Locked = Me.cboSite.ListCount < 1
Me.cboSite.Enabled = Me.cboSite.ListCount > 0
Me.cboCont.Requery
Me.cboCont = ""
Me.cboCont.Locked = Me.cboCont.ListCount < 1
Me.cboCont.Enabled = Me.cboCont.ListCount > 0
End Sub]
Steven811