473,837 Members | 1,523 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

applying filter to form

37 New Member
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 1892
puppydogbuddy
1,923 Recognized Expert Top Contributor
Try using Or instead of And in your criteria:

stlinkcriteria = "[" & Me![Combo65] & "] not like 'installed' Or 'na'"
Sep 21 '07 #2
ADezii
8,834 Recognized Expert Expert
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
cmartin1986
37 New Member
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
cmartin1986
37 New Member
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 Recognized Expert Top Contributor
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
cmartin1986
37 New Member
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
2778
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 report. What I would like is to obtain the ID field from the filtered form, and show only those ID's in the report. K
4
3578
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 property string to the string from the module works fine. As soon as I put the form on the "main form" (thereby coverting it to a sub form) things no longer work. Of course the record source for the sub form is no longer a table or query, but the...
6
5480
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 started. The Query contains the 3 fields above with !! // filters. When entering data in the formfields and hitting the button the query shows the results as filtered in the formfields.
1
1552
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 filter as a single query? or, do the variables entered on the main form need to be saved as its own individual query, and the variables entered on the subform saved as a separate query. I ask because I would ideally like to take a single query,...
2
2906
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 question is : POL_Change_Allocated - This is a yes/no tick box. I want to filter for all forms where the tick hasn't been applied. (Am I right in thinking that this means this field is no unless ticked?) The main form feeds from table OCP Base...
7
2704
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 project, I want to open the form using the "On Open" event, via the properties of the form, and leave my record source pointing to the original table that was used to set it up. My problem is that I am not too sure what the vba coding would be. ...
9
3095
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
1704
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 the code I get an message asking to input the value for the filter even though I stated it in the code. FileName = ("AutoNumber=" + numbers) MsgBox (FileName) Me.Filter = FileName Me.FilterOn = True The message box call is just something I...
13
2122
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 category. On the Vendor form, there's a subform called Vendor_Category. When a user is in the Vendor form and is in a record for a particular vendor_id, they use a combo_box in the Vendor_Category subform to select Vendor_Categories that can...
0
9682
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10881
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10628
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10275
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9406
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7004
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5850
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4043
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3126
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.