By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,320 Members | 2,239 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,320 IT Pros & Developers. It's quick & easy.

How can I make this filter work

100+
P: 147
I have a command buttton on a form that calls a report and filters the report as follows:

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnLetter_Click()
  2. Dim strSQL As String
  3. Dim stLetter As String
  4. Dim stFilter As String
  5.  
  6.     DoCmd.Close
  7.  
  8.     stLetter = "rptParkingLetter"
  9.     DoCmd.OpenReport stLetter, acViewPreview
  10.     stFilter = ("Letter2Sent Is Null And InDispute = No And Closed = No")
  11.  
  12. 'Build SQL String
  13.     strSQL = strSQL & stFilter & " And "
  14.  
  15.     If strSQL <> "" Then
  16.     'Strip Last " And "
  17.         strSQL = Left(strSQL, (Len(strSQL) - 5))
  18.         'Set the Filter property
  19.         Reports!rptParkingLetter.Filter = strSQL
  20.         Reports!rptParkingLetter.FilterOn = True
  21.     End If
  22. End Sub
  23.  
My problem is line 10 I don't know how to show No as "No" so the report will see it as a value.
Mar 5 '09 #1
Share this Question
Share on Google+
5 Replies


NeoPa
Expert Mod 15k+
P: 31,661
What type of fields are [InDispute] and [Closed] Dan?
Mar 5 '09 #2

100+
P: 147
they are text fields.
Mar 5 '09 #3

NeoPa
Expert Mod 15k+
P: 31,661
In that case you simply want (For further info see Quotes (') and Double-Quotes (") - Where and When to use them) :
Expand|Select|Wrap|Line Numbers
  1. stFilter = ("Letter2Sent Is Null And InDispute = 'No' And Closed = 'No'")
Mar 5 '09 #4

100+
P: 147
Thank you! and thanks for the explanation link.
Dan
Mar 5 '09 #5

NeoPa
Expert Mod 15k+
P: 31,661
No worries Dan. You can guess we've had similar questions before ;)
Mar 5 '09 #6

Post your reply

Sign in to post your reply or Sign up for a free account.