I'm trying to filter a subform based on fields selected from a field list and criteria chosen.
So far I'm trying to use the following code, but I'm having a little trouble with it. I know this is a question only an expert could probably answer, so I'm assigining it the maximum value. Thanks.
Private Sub Set_Filter_Click()
Dim strSQL As String, intCounter As Integer 'Build SQL string.
For intCounter = 1 To 3
If Me("Filter" & intCounter) <" " Then
strSQL = strSQL & "[" & Me("Filter" & intCounter).Tag & "]
" & " = " & Chr(34) & Me("Filter" & intCounter) & Chr(34) & " And "
End If
Next
If strSQL <"" Then ' Strip Last " And ".
strSQL = Left(strSQL, (Len(strSQL) - 3)) ' Set the Filter
Property.
Reports![rptOwner].Filter = strSQL
Reports![rptOwner].FilterO
n = True
End If
End Sub
Start Free Trial