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

Getting started with filters.

I have two questions regarding using filters.

One: I would like to be able to filter the records, displayed in a form
based on several criteria using checkboxes or option buttons. The table has
a number of Yes/No fields that are used to describe an item. These include
things such as BlueColor, RedColor, etc. On the form I want to have a
seperate button for each attribute. As the user selects one of the buttons I
want to filter the list to include only those records that have that
attribute. This would be done most likely using docmd.applyfilter. The catch
is, the user might select BlueColor so the list should show only records
where BlueColor is True. Then they might select RedColor and I want the list
to to then show all records where BlueColor is True and RedColor is True.

Two: On the above described form is a button to Check or Uncheck all records
(each record has a field called PrintMe used for this purpose). How can I
set up the filtering so that Check all would only affect those records in
the filtered dataset?

I'd appreciate some input on where to begin. Please ask if something is
unclear.
Feb 22 '07 #1
1 1589

Jimmy wrote:
I have two questions regarding using filters.

One: I would like to be able to filter the records, displayed in a form
based on several criteria using checkboxes or option buttons. The table has
a number of Yes/No fields that are used to describe an item. These include
things such as BlueColor, RedColor, etc. On the form I want to have a
seperate button for each attribute. As the user selects one of the buttons I
want to filter the list to include only those records that have that
attribute. This would be done most likely using docmd.applyfilter. The catch
is, the user might select BlueColor so the list should show only records
where BlueColor is True. Then they might select RedColor and I want the list
to to then show all records where BlueColor is True and RedColor is True.

Two: On the above described form is a button to Check or Uncheck all records
(each record has a field called PrintMe used for this purpose). How can I
set up the filtering so that Check all would only affect those records in
the filtered dataset?

I'd appreciate some input on where to begin. Please ask if something is
unclear.
My preference to doing something like this is build a WHERE statement
and append it to a base query. I feel this makes the process more
flexible and limits results before a filter would be applied. I
usually start this process on either a form opening or in the click
event of a "Refresh" button. It would go something like this.

Dim SelPart as String
Dim WhrPart as String

If {confirm that a value has been selected} then
WhrPart=WhrPart & " ([fldName]='" & [controlname] & "') AND"
'Make sure the string is appropriate for the datatype
' proper quotes for strings, # around dates blah,blah
End If

'Do above for each control in criteria.
'Use a loop if many controls need to be checked

If WhrPart<>"" Then
'Remove trailing ANDs
WhrPart=Left(WhrPart,Len(WhrPart)-4)
WhrPart="WHERE(" & WhrPart & ")"
End If

Me.RecordSource=SelPart & WhrPart & ";"
Me.Requery

Feb 22 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Christian Tismer | last post by:
Dear friends. During a conversation with good friends and newly acquired Pythonista, we were discussing Python, what it is in essence, and what it is giving to us. The people were Dinu...
6
by: Jack Duijf | last post by:
Hello, I am looking for a person in The Netherlands that is willing to help me getting started with Vb.net. Please send a message to jack@aicn.nl if you can help me getting started with the...
6
by: TJO | last post by:
Below is some sample code that fades div tags that is not working in IE 6.0.29 on xp sp2. Can anyone help see why the if(ie5) document.getElementById(divID).filters.alpha.opacity lines are not...
1
by: Dieter Vanderelst | last post by:
Hello, I'm trying to access the Filters-Dll provided by the filters-project (http://filters.sourceforge.net/index.htm). Following the advice I got from the Python list -thank you for that-, I...
0
by: kucol | last post by:
Hi guys, I wanted to ask you for help as I am struggling with it second evening already... I have got tables DEVICES and PARTS. One device can consist of multiple parts. But... I have...
1
by: lawton | last post by:
Source: this is an access 2003 question My knowledge level: reading books, internet, and trial & error; no formal training I'm trying to get a running sum of what's filtered in a subform which is...
3
by: paulus4605 | last post by:
dears since I'm new to ruby I try to create a form within ruby on rails. this is my controller require "player" class SpelersController < ApplicationController def index @speler =...
1
by: viswanathtvs | last post by:
java.util.NoSuchElementException javax.faces.el.EvaluationException: java.util.NoSuchElementException at...
0
by: CatchSandeepVaid | last post by:
We all know that one-to-one associations are non-lazly fetched but during this fetching the filters are not applied. I debugged hibernate code and found that hibernate finally calls...
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...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.