473,394 Members | 1,843 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,394 software developers and data experts.

Filtering a Filter

Kaosu
19
My database holds a list of names for all employees from my comany past and present. There is a tickbox on one of my forms that displays in red writing that the person is no longer with the company. I wanted to know if there was a way to use this tickbox in a name search that will eliminate the leavers from the current staff in the results list.

Name search:
Expand|Select|Wrap|Line Numbers
  1. Private Sub fnSRH_AfterUpdate()
  2.     Dim strFilter As String
  3.     strFilter = ""
  4.     If IsNull(Me!fnSRH) Then
  5.         strFilter = strFilter
  6.     Else
  7.         If strFilter = "" Then
  8.             strFilter = strFilter & "FullName Like '*" & Me!fnSRH & "*'"
  9.         Else
  10.             strFilter = strFilter & " AND FullName Like '*" & Me!fnSRH & "*'"
  11.  
  12.     End If
  13.     End If
  14.  
  15.     Me.Filter = strFilter
  16.     Me.FilterOn = True
  17.     Me!fnSRH = Null
  18.  
  19. End Sub 
ID search:
Expand|Select|Wrap|Line Numbers
  1. Private Sub idSRH_AfterUpdate()
  2.     DoCmd.GoToControl "ID"
  3.     DoCmd.FindRecord Me!idSRH
  4.     Me!idSRH = Null
  5.  
  6. End Sub 
Jun 16 '08 #1
2 1094
JKing
1,206 Expert 1GB
If I understand your problem correctly, then all you would need to do is extend your filter criteria. You can do this by adding an "AND" clause to your statement that checks to see if your checkbox field is true or false.

Example:

Assuming your checkbox field is called "unemployed", this example would filter the form by any names that match the control fnSRH and also have the field unemployed set to false.

Expand|Select|Wrap|Line Numbers
  1. strFilter = strFilter & "FullName ='" & Me!fnSRH & "' AND unemployed = FALSE"
  2.  

You can filter by any field you want and as many fields as you want or need to. You just have to ensure that your filter strings are properly formed.

Hope this helps you,
Jared
Jun 17 '08 #2
Kaosu
19
thanks, that worked very well.
Jun 17 '08 #3

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

Similar topics

3
by: Jason | last post by:
I am trying to filter records in a primary form based on records in related tables. The data in the related tables is being displayed in the primary form through subforms. To be more specific, I...
5
by: Richard | last post by:
Hi, I have a form that take some time to load due to many comboboxes and at least 8 subforms. When I filter or sort the main form I get an error message and then Access shuts down. They ask if...
19
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main...
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...
0
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
16
by: LabWINC | last post by:
Hi all, i'm looking for a module to implement a digital FIR filter! Can anyone help me? Thanks, Vincent
3
by: Shawn Ramirez | last post by:
As with most web applications speed is a huge deal to me in my applications. My customers don't really care if my app is a true 3 tier application or not, they just want it to be faster then it was...
0
by: Lyn | last post by:
I have a problem using the form .Filter and .FilterOn properties which causes Access to crash (as detailed in a separate post). The form operates in continuous mode, displaying matching records...
0
by: Romulo NF | last post by:
Greetings again everyone Recently i´ve been asked to develop a script to allow filtering in the content of the table, with dinamic options based on the own content. Example: a table with the name of...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.