473,395 Members | 2,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How can I make this filter work

147 100+
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
5 1372
NeoPa
32,556 Expert Mod 16PB
What type of fields are [InDispute] and [Closed] Dan?
Mar 5 '09 #2
DAHMB
147 100+
they are text fields.
Mar 5 '09 #3
NeoPa
32,556 Expert Mod 16PB
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
DAHMB
147 100+
Thank you! and thanks for the explanation link.
Dan
Mar 5 '09 #5
NeoPa
32,556 Expert Mod 16PB
No worries Dan. You can guess we've had similar questions before ;)
Mar 5 '09 #6

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

Similar topics

12
by: Fred Pacquier | last post by:
First off, sorry for this message-in-a-bottle-like post... I haven't been able to phrase my questions well enough to get a meaningful answer from Google in my research. OTOH, it is standard...
7
by: Vic | last post by:
Dear All, I found this code snippet on this list (taken from a nice webpage of a courteous fellow), which I used to filter a form on a combo box. I wanted to repeat the same code to have an...
3
by: Baz'noid | last post by:
Hi all, With the recent postal strikes here in the UK i'm trying to persuade access to email reports at the touch of a button. I've not been able to figure out how to filter the report - when i...
2
by: Brian Newman | last post by:
I've got what is actually a triple-layer nested form. That part works fine. I've got the first subform related by the right key field to the main form, then I've got the second subform related to...
1
by: jeffgeorge | last post by:
Hi all. Trying to move Filter By Selection, Filter By Form, and Apply/Remove Filter directly into my form. No luck. Is there anyway to move them into the header of the form or, as another...
2
by: Vic | last post by:
Dear All, I am getting the following error message : "You cannot assign a value to this object" ("Me.filter =" is highlighted) I have two comboboxes (ByGenes and BySpecies)with lists in them...
6
by: Peter | last post by:
Hi, I have two simple classes called 'User' and 'Users', the entire code for both classes is shown below. ****======== User.cs ========**** public class User { private string...
9
by: dee | last post by:
I'd like to filter by the following criteria: left(LeadDisposition,3) = "Sit" AND Appt_Date = Text767 I have no idea how to do this. Appreciate help.
3
by: emgallagher | last post by:
I have a form which lists studies. People can filter the form based on details about the study, such as the study type. Currently users filter via the right click method. I would like to be...
1
by: woodey2002 | last post by:
Hi Everyone and many thanks for your time.. I am trying to begin access and a bit of VBA i am enjoying it but I have a annoying problem I just can’t get any where on. My databse mostly includes...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.