Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Synchronizing Cascading Combo Boxes

Status
Not open for further replies.

CCRT

Technical User
Jul 27, 2005
14
0
0
US
I have a form with 3 cascading combo boxes
cboProblemMain
cboProbLevel1
cboProbLevel2

It works fine unless the user decides to go back and change the cboProblemMain or cboProbLevel1 after initial input. Then they are out of sync. Is there anything I can add to my code that will refresh to a blank field or force the user to revisit the out of sync fields?
Thanks
--Dave


Code:
Private Sub cboProblemMain_AfterUpdate()
   On Error Resume Next
   Select Case cboProblemMain.Value
      Case "Electrical"
        cboProbLevel1.RowSource = "tblElectrical"
      Case "Mechanical"
        cboProbLevel1.RowSource = "tblMechanical"
      Case "Documentation"
       cboProbLevel1.RowSource = "tblDocumentation"
   End Select   
     
End Sub

Private Sub cboProbLevel1_AfterUpdate()
   On Error Resume Next
 
   Select Case Left(cboProbLevel1.Value, 2)
      Case "E-"
        cboProbLevel2.RowSource = "tblElectricalDetail"
      Case "M-"
        cboProbLevel2.RowSource = "tblMechanicalDetail"
      Case "D-"
        cboProbLevel2.RowSource = "tblDocumentationDetail"
        
    End Select

End Sub



 
In cboProblemMain_AfterUpdate add the following line at the end:
cboProbLevel2.RowSource = ""

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top