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

List Box With Multiple Filters

171 100+
Hi,
I have a form where users have to go through a lot of data. The data is being viewed in a list box. This is because they need to be able to select one of the items in the list. The list box will pick up filter criteria from text boxes on the form. Basically a user may want to use different criteria to do there search. At the moment I have got Date and Amount so for date I want to give the option where the user can leave the date blank or enter a date, and if the date is blank then no date filter should be applied.

*The following code is in access query builder, I had put this into the criteria section of the Builder.

Expand|Select|Wrap|Line Numbers
  1. iif(isnull(Forms!FrmFilter!tbDate),>#01/01/1900#,Forms!FrmFilter!tbDate)
This does not seem to work, it filters properly when I put a date in, but not when the text box is null. What it should do is allow me to fill in either both amount and date criterias or either date or amount or fill in no criteria at all and filter the listbox accordingly.


Thanks in advance
Feb 25 '09 #1
6 3924
Hi mate

I found a great example on the site below maybe it can help you also.

Regards, JAMES
*** Edit - Illegal link removed ***
Feb 25 '09 #2
NeoPa
32,556 Expert Mod 16PB
Sorry James. I know you're new, but we don't allow links to competing forums here (Check out the rules via the Help link on every page). Microsoft links are fine for Microsoft applications, but for others we need content rather than a link.

-Administrator.

PS. Appreciate you're just trying to help of course.
Feb 25 '09 #3
NeoPa
32,556 Expert Mod 16PB
You should find all you need to know in Example Filtering on a Form.

This refers to filtering for data on a form, and your question is about filtering a ListBox control instead, but the fundamental filtering should be the same. You still add the item to the filter only if a value to filter is selected.

The main difference is that whereas a form can be filtered using a string parameter (WhereCondition) in the call to open the form, in a ListBox control the filtering would form the WHERE clause of the RecordSource SQL.
Feb 25 '09 #4
No problem.

Thanks for the advice.

Won't do again.

Kind regards,

James.
Feb 25 '09 #5
ChipR
1,287 Expert 1GB
Try changing

>#01/01/1900#

To

">#01/01/1900#"

Or

""
Feb 25 '09 #6
iheartvba
171 100+
Thanks everyone here's a summary of what I've learnt and succesfully implemented. If you want to pass criteria to a listbox, here is an easy way to do it.
Step 1: Write your SQL string
Step 2: Pass it to the list box i.e. me.listbox.rowsource = (the SQL string you have written

I really do heart VBA :D
Feb 27 '09 #7

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

Similar topics

3
by: Bryan Harrington | last post by:
Hello all.. I'm working on an application that has a worklist of items for users to work on. I'd like to, based on user security, to filter a worklist based on between 1 and 8 items (i.e.,...
1
by: tremor | last post by:
I'd like to print a form based on the filters currently applied to it (these are again based on selections in combo-boxes). The form has multiple subforms, and as I try to print it, it prints all...
3
by: Kriston-Vizi Janos | last post by:
Dear Mr. Kern, and Members, Thank you very much for the fast answer, my question became over-simplified. My source code is appended below. It uses two text files (L.txt and GC.txt) as input...
2
by: yxktmp | last post by:
Hi; I have a main starting query for most of my reporting. I branch out from this query to other queries. This main query contains multiple form control filters (query criterias) . I want to use...
1
by: favor08 | last post by:
I need help with a big project. I am struggle getting multiple option buttons and filters to work together. They need to be able to filter a subform. My first set of option buttons work fine all...
8
by: dancole42 | last post by:
I have a form called CustomerLookup. It displays a DataSheet of all our customers so that someone can quickly and easily view all our customers. When someone double clicks on one of the...
1
by: Memphis Steve | last post by:
Is it possible to combine multiple javascipts into one file and then call that file from a linked URL in the head section of an XHTML file? Here are the two scripts I want to use with the...
1
by: freetime | last post by:
Greetings, This is my first post so I will try to be brief and accurate. I have a report that uses 9 user selectable filters (Dates, Y/N's as Combo Boxes and 4 Multi-Select List Boxes. ...
1
by: woodey2002 | last post by:
Hi Everyone and many thanks for your time.. I am trying to begin access and a bit of VBA i am enjoying it but I have a annoying problem I just can’t get any where on. My databse mostly includes...
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: 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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.