Hello,
I am having a bit of trouble linking a list on my form to combo boxes on the smae form.
They are cascading combo boxes and i am trying to filter the list depending on what is selected in the combo boxes.
here is my code
Code:
Private Sub FilterMachineList()
Dim strRS As String
' Filter the list box appropriately based on the combo box selection(s)
strRS = "SELECT qrymachine.SuffixName"
If Not IsNull(Me.cboSuffixID) Then
strRS = strRS & " WHERE SuffixID = " & Me.cboSuffixID
ElseIf Not IsNull(Me.cboSizeID) Then
strRS = strRS & " WHERE SizeID = " & Me.cboSizeID
ElseIf Not IsNull(Me.cboModelID) Then
strRS = strRS & " WHERE ModelID = " & Me.cboModelID
End If
strRS = strRS & " ORDER BY qrymachine.SuffixName;"
Me.lstMachineID.RowSource = strRS
Me.lstMachineID.Requery
End Sub
the order that the combo boxes are selected is Model ID, Size ID and finally Suffix ID.