Hi All
I have a requirement to use three combo boxes to successively refine the selection of records. I recently saw a solution by A9192Shark which I have attempted to adapt to my case.
It works up to a point but in the end selects on only one parameter, and then occasionally throws up an error.
Code
Private Sub BuildFilter()
strFilter = ""
If IsNull(Me.cmbCode) Then
strFilterCode = ""
Else
strFilterCode = "(Code = '" & Me.cmbCode & "')"
End If
If IsNull(Me.cmbDescription) Then
strFilterDescription = ""
Else
strFilterDescription = "(Description = '" & Me.cmbDescription & "')"
End If
If IsNull(Me.cmbBand) Then
strFilterBand = ""
Else
strFilterBand = "(Band = '" & Me.cmbBand & "')"
End If
If strFilterCode <> "" And strFilterDescription <> "" And strFilterBand <> "" Then
strFilter = strFilterCode & " AND " & strFilterDescription & " AND " & strFilterBand
Else
strFilter = strFilterCode & strFilterDescription
End If
With Me.subfrmP_OpalBuy.Form
.FilterOn = False
.Filter = strFilter
.FilterOn = True
End With
Me.txtFilter = IIf(strFilter = "", "No filter", strFilter)
Me.Requery
End Sub
Display More
Can someone see where the error/s might be?
Thanks to A9192Shark for getting me to this point, which is a whole lot closer than I would have been starting from scratch
Regards
Robert