473,399 Members | 2,478 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,399 software developers and data experts.

Applying a filter on a Subform. Combo box Filter

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 Tables
The Subform feeds from table POL Actions

These two tables are both linked on the form using OCP Ref

I started to write the code below, but realised this would just return non blanks, whereas I am looking to return all forms where "no" is selected. Also I started to get bogged down in the code, but as the filter needs to be on the subform I didnt think I could apply a normal filter.

I am new to both access and VBA so please can you explain what on earth I am doing wrong.
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Pending_Changes_Click()
  3. Dim strSQL As String
  4. If IsNull(Me.{POL_Change_Allocated) Then
  5.     ' If the combo is Null, use the whole table as the RecordSource.
  6.     Me.RecordSource = "OCP_Base_tables"
  7. Else
  8.     strSQL = "SELECT DISTINCTROW tblOCP_Base_Tables.* FROM tblOCP_Base_Tables " & _
  9.         "INNER JOIN tblPOL_Actions ON " & _
  10.         "tblOCP_Base_Tables.OCP_Ref = tblPOL_Actions.OCP_Ref " & _
  11.         "WHERE tblPOL_Actions.POL_Change_Allocated = " & Me.Pending_Changes & ";"
  12.     Me.RecordSource = strSQL
  13. End If
  14. End Sub
Jan 10 '08 #1
2 2877
I thought the isnull would work as the filter I am trying to apply is one with a tick in it. If that makes sense.
Jan 10 '08 #2
Just for information what I am trying to do is set a filter to return forms that are yet to be completed. therefore the checkbox hasn't been ticked.
Jan 10 '08 #3

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

Similar topics

2
by: cefrancke | last post by:
I have a form (no underlying record set) that has two separate sub-forms on it. Each sub-form has data from two different tables. Above each sub-form there is one unbound combo box with a SQL...
1
by: jjchristiansen | last post by:
I have a form in which I am trying to filter a query using up to 6 combo bixes. The problem is, unless all 6 combo boxes are selected properly, nothing will apear in the Subform. I would like...
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...
3
by: Stewart | last post by:
Hi all! My (relatively small) database holds data on staff members and the projects (services) that they are assigned to. In my form frmStaff, I have a list of staff members - it is a...
9
by: natwong | last post by:
Hi All, I'm a newbie in terms of Access and some of its functionality . I've been stuck on this problem for a couple days, even after searching the Web, etc. Currently I have five combo boxes...
5
by: favor08 | last post by:
I have a database and I am using a function that captures the shortname and displays it on the mainMenu screen. What I want to do is filter the information on the "past due" screen based on the...
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: patriciashoe | last post by:
Greeting All I have several public variables which I use to build a filter string that I would like to use when I open a form and several associated sub forms. I have set the value of the combo...
1
by: kinglioness | last post by:
Hello All, I am new to this forum so I apologize if this quesiton was asked already. Although i did search but i couldn't find. I have 2 combo boxes one unbound and the other bound they are on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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.