Filter not working with numeric values? Please Help..

G

Gina Whipp

Hi All,

Below is the filter I am using but with numeric values it's not working, can
someone tell me what I am missing?

Big THANKS!

Dim strSql As String, intCounter As Integer
'Build SQL String
For intCounter = 1 To 2
If Me("Filter" & intCounter) <> "" Then
strSql = strSql & "[" & Me("Filter" & intCounter).Tag & "] " &
" = " & Chr(34) & Me("Filter" & intCounter) & " And "
End If
Next

If strSql <> "" Then
'Strip Last " And "
strSql = Left(strSql, (Len(strSql) - 4))
'Set the Filter property
Reports![rptBudgetByProject].Filter = strSql
Reports![rptBudgetByProject].FilterOn = True
Else
Reports![rptBudgetByProject].FilterOn = False
End If
 
J

John Vinson

Hi All,

Below is the filter I am using but with numeric values it's not working, can
someone tell me what I am missing?

It's not something missing - it's something extra. If the field is
numeric then you should NOT delimit it with quotemarks.

It looks like you have only one quotemark (unbalanced) anyway - just
remove it:

strSql = strSql & "[" & Me("Filter" & intCounter).Tag &
"] = " & Me("Filter" & intCounter) & " And "

If you've got a mix of text and number fields for the various filters,
you'll need to determine which field is numeric and which is text and
add delimiters only for the text fields.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top