Hi
I've got an interesting problem that I'm not sure how to solve. A while back I managed to get a custom filter to work on a form. See code below:
yeah I know, should label the code
Anyway, the code works as expected: a user choose however many combo-boxes they want for the filter, click on the filter button and the records get sorted as such. However, I am finding that two of my boxes are asking Parameters - cboFilteredCalibration and cboFilteredPatTested. When you select either YES, NO, N/A (or other ones that are added into the table) and press the filter button, I get a parameter check. Entering the chosen option doesn't apply the filter and leaving the box blank treats it as a non-option, so no records appear.
how can I remove the Parameter queries that appear?
I've got an interesting problem that I'm not sure how to solve. A while back I managed to get a custom filter to work on a form. See code below:
Code:
'------------------------------------------------------------
' cmdApplyFilter_Click
'
'------------------------------------------------------------
Private Sub cmdApplyFilter_Click()
Dim filterStr As String
If Me.cboFilterAssetGroup.ListIndex <> -1 Then filterStr = filterStr & "[Asset Group] = '" & Me.cboFilterAssetGroup & "' And "
If Me.cboFilterCalibrated.ListIndex <> -1 Then filterStr = filterStr & "[Calibrated?] = '" & Me.cboFilterCalibrated & "' And "
If Me.cboFilterPatTested.ListIndex <> -1 Then filterStr = filterStr & "[PAT Tested?] = '" & Me.cboFilterPatTested & "' And "
If Me.cboFilterHub.ListIndex <> -1 Then filterStr = filterStr & "[Hub] = '" & Me.cboFilterHub & "' And "
If Me.cboFilterLocation.ListIndex <> -1 Then filterStr = filterStr & "[Location] = '" & Me.cboFilterLocation & "' And "
If Me.cboFilterUser.ListIndex <> -1 Then filterStr = filterStr & "[User] = '" & Me.cboFilterUser & "' And "
If Len(filterStr) > 0 Then
filterStr = Left(filterStr, Len(filterStr) - 4)
Me.Filter = filterStr
Me.FilterOn = True
End If
End Sub
yeah I know, should label the code
how can I remove the Parameter queries that appear?