472,354 Members | 1,444 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

applying filter to form

What I'm trying to do is add a button to my "front" page which will open a form and filter excluding the words "installed" and "na" in the field declared by my combo box. I've pretty much got it figured out except I can get it to filter out more than one of the two words. Here is what I've got:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command82_Click()
  2. On Error GoTo Err_Status_Click
  3.  
  4.     Dim stdocname As String
  5.     Dim stlinkcriteria As String
  6.  
  7.     stdocname = "Workstatement Boilerplate"
  8.  
  9.     stlinkcriteria = "[" & Me![Combo65] & "] not like 'installed' and 'na'"
  10.     DoCmd.OpenForm stdocname, , , stlinkcriteria
  11.  
  12. Exit_status_Click:
  13.     Exit Sub
  14.  
  15. Err_Status_Click:
  16.     MsgBox Err.Description
  17.     Resume Exit_status_Click
  18.  
  19.  
  20.  
  21. End Sub
  22.  
Thanks for your help.
Sep 21 '07 #1
6 1784
puppydogbuddy
1,923 Expert 1GB
Try using Or instead of And in your criteria:

stlinkcriteria = "[" & Me![Combo65] & "] not like 'installed' Or 'na'"
Sep 21 '07 #2
ADezii
8,832 Expert 8TB
What I'm trying to do is add a button to my "front" page which will open a form and filter excluding the words "installed" and "na" in the field declared by my combo box. I've pretty much got it figured out except I can get it to filter out more than one of the two words. Here is what I've got:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command82_Click()
  2. On Error GoTo Err_Status_Click
  3.  
  4.     Dim stdocname As String
  5.     Dim stlinkcriteria As String
  6.  
  7.     stdocname = "Workstatement Boilerplate"
  8.  
  9.     stlinkcriteria = "[" & Me![Combo65] & "] not like 'installed' and 'na'"
  10.     DoCmd.OpenForm stdocname, , , stlinkcriteria
  11.  
  12. Exit_status_Click:
  13.     Exit Sub
  14.  
  15. Err_Status_Click:
  16.     MsgBox Err.Description
  17.     Resume Exit_status_Click
  18.  
  19.  
  20.  
  21. End Sub
  22.  
Thanks for your help.
Try:
Expand|Select|Wrap|Line Numbers
  1. stlinkcriteria = "Me![Combo65] Not Like '*installed*' And Me![Combo65] Not Like '*na*';"
Sep 21 '07 #3
I tried both the possible soloutions you guys provided and neither worked... They both just showed all records. Any other ideas would be great.

Thanks again.
Sep 24 '07 #4
I tried both the possible soloutions you guys provided and neither worked... They both just showed all records. Any other ideas would be great.

Thanks again.
Sep 24 '07 #5
puppydogbuddy
1,923 Expert 1GB
I tried both the possible soloutions you guys provided and neither worked... They both just showed all records. Any other ideas would be great.

Thanks again.
Try changing this:

DoCmd.OpenForm stdocname, , , stlinkcriteria

To:

DoCmd.OpenForm stdocname, , stlinkcriteria
Sep 24 '07 #6
Got it to work.. Thanks,
Sep 24 '07 #7

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

Similar topics

5
by: k | last post by:
Hi I have a form which the user can apply filters, and push a button to preview a report. I cannot use me.filter=forms!myform.filter, because some of the filtered fields are not present in the...
4
by: MS | last post by:
I'm having trouble applying a filter to a subform. I create a String in a Module based on various selections on the form. Clicking a button on the "stand alone form" that changes the filter...
6
by: sanniep | last post by:
Hello, I've got a form like this: Name: _(free text input)__ Adress: _(free text input)_ City: _(free text input)_ When clicking a Apply Filter button on the form a query is...
1
by: jcf378 | last post by:
Is it possible to set a main-form with an embedded subform to "Filter by Form", subsequently enter the desired variables in fields in BOTH the main-form and subform, and then save the resulting...
2
by: jambonjamasb | last post by:
What I am trying to do is have a combo box which allows me to filter for a certain field in a subform. I can't think how to do this and have tried with the follwoing code. Basically the field in...
7
kcdoell
by: kcdoell | last post by:
Hello: I have a form that I want to open using a filter that I have created. I have done this usually by pointing the record source of the form to the query/filter that I created. In this new...
9
by: angi35 | last post by:
Hi - In Access 2000, I have a form I want to filter, but I can't get the syntax right in the code. Form: Subform: Control on : txtStart Nested Subform on : Control on : txtSDate
1
Fr33dan
by: Fr33dan | last post by:
Hi. I've been working on a database for awhile now and I have a button on a form that is supposed to apply a filter based on criteria from the user. However when I actually go to apply the filter in...
13
by: bkberg05 | last post by:
Hi - I have a form called Vendor (tied to table with same name). Each vendor_id can belong to more than one 'category'. So there's a table called Vendor_Category which contains just vendor_id and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made but the http to https rule only works for...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...

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.