Hello,
I found a tutorial on how to use combo boxes to filter. I got it to work but I cannot reset the succeeding boxes when i change the initial combo box to another selection.
In the first picture below, everything flows smoothly as far as filtering but when I change the location to Madison, the Equipment and Station choices dont clear like the Plant does.
Can anyone help me with the coding to reset the succeeding boxes of combo box when a change a selection of a combobox that precedes them.
Thanks
Coding Used:
Option Compare Database
Private Sub cboLocation_AfterUpdate()
Dim sPlantSource As String
sPlantSource = "Select [tblPlant].[lngPlantID], [tblPlant].[lngLocationID], [tblPlant].[strPlantName] " & _
"FROM tblPlant " & _
"WHERE [lngLocationID] = " & Me.cboLocation.Value
Me.cboPlant.RowSource = sPlantSource
Me.cboPlant.Requery
End Sub
Private Sub cboPlant_AfterUpdate()
Dim sEquipmentSource As String
sEquipmentSource = "Select [tblEquipment].[lngEquipmentID], [tblEquipment].[lngPlantID], [tblEquipment].[strEquipmentName] " & _
"FROM tblEquipment " & _
"WHERE [lngPlantID] = " & Me.cboPlant.Value
Me.cboEquipment.RowSource = sEquipmentSource
Me.cboEquipment.Requery
End Sub
Private Sub cboEquipment_AfterUpdate()
Dim sStationSource As String
sStationSource = "Select [tblStation].[lngStationID], [tblStation].[lngEquipmentID], [tblStation].[strStationName] " & _
"FROM tblStation " & _
"WHERE [lngEquipmentID] = " & Me.cboEquipment.Value
Me.cboStation.RowSource = sStationSource
Me.cboStation.Requery
End Sub