473,396 Members | 2,087 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.

Filter Report by values from two list box

I am having a list box where I will select the Plants (Plant-1 or
Plant-2 Etc.) or leave blank for selecting all plants. Another list box
in the same form where the supervisors list is provided. A report named
"Assigned Jobs" shall open by meeting all the following conditions

1) Both Plant list box and supr list box not selected
2) Plant list box selected and supr list box not selected
3) Plant list box not selected but supr list box selected
4) Both Plant and supr list boxes are selected

Dec 31 '06 #1
3 2655
<jo********@yahoo.comwrote in message
news:11*********************@n51g2000cwc.googlegro ups.com...
>I am having a list box where I will select the Plants (Plant-1 or
Plant-2 Etc.) or leave blank for selecting all plants. Another list box
in the same form where the supervisors list is provided. A report named
"Assigned Jobs" shall open by meeting all the following conditions

1) Both Plant list box and supr list box not selected
2) Plant list box selected and supr list box not selected
3) Plant list box not selected but supr list box selected
4) Both Plant and supr list boxes are selected
In the query used by the report set criteria to...

WHERE (PlantField = Forms!FormName!PlantListBox
OR Forms!FormName!PlantListBox Is Null)
AND (SuprField = Forms!FormName!SuprListBox
OR Forms!FormName!SuprListBox Is Null)

This assumes that neither ListBox allows multiple selections.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Dec 31 '06 #2

Thanks for your reply.

But My problem is that both of the list boxes may have multiple
selections.

Jan 1 '07 #3

jo********@yahoo.com wrote:
I am having a list box where I will select the Plants (Plant-1 or
Plant-2 Etc.) or leave blank for selecting all plants. Another list box
in the same form where the supervisors list is provided. A report named
"Assigned Jobs" shall open by meeting all the following conditions

1) Both Plant list box and supr list box not selected
2) Plant list box selected and supr list box not selected
3) Plant list box not selected but supr list box selected
4) Both Plant and supr list boxes are selected
So what's the big deal? You loop through the ItemsSelected collection
of the MSLB, create a filter, and pass it as a filter in the open event
of the report. If there is no selection, then that filter is not
built. Just test the value before you append it to the criteria list.
There's an example at AccessWeb...

http://www.mvps.org/access/reports/rpt0005.htm

Jan 3 '07 #4

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

Similar topics

9
by: Robin Cull | last post by:
Imagine I have a dict looking something like this: myDict = {"key 1": , "key 2": , "key 3": , "key 4": } That is, a set of keys which have a variable length list of associated values after...
3
by: arthur-e | last post by:
I can filter a query for a report on a field of a subform BUT now.... I'd like to be able to select more than one item in a multi-list box to select all the records. ALSO to use two fields (or...
3
by: Richard | last post by:
Hi, I have a form based on a table. When I filter the form I want to run a report based on the same table with the same filter as the form. No problem until I want to filter a combo box where...
8
by: dick | last post by:
I am just trying to print/report the results of a "filter by selection" which is done by right-clicking a form, filling in values, and "applying the filter." I have searched the newsgroups, and...
2
by: Heather | last post by:
I want to create a report that shows the percent of safety audits complete by each individual shift, based on the safety audit date. The user has to put in the dates they want the report to pull...
5
by: dkelly925 | last post by:
Is there a way to add an If Statement to the following code so if data in a field equals "x" it will launch one report and if it equals "y" it would open another report. Anyone know how to modify...
2
by: Thall | last post by:
Hey Gurus - I've seen a few solutions to this problem, but none of which I can do without a little help. Here's the situation The following code loops thru a sales report, using the sales rep ID...
4
by: Fran | last post by:
I recently tried to use code for "Use a multi-select list box to filter a report" from Allen Browne in my database. I was able to add the code and adapt it to my needs, however I am getting an...
3
by: franc sutherland | last post by:
Hello, I have a report which I filter using the me.filter command in the OnOpen event. Me.Filter = "OrderID=" & Forms!variable_form_name! Me.FilterOn = True I want to be able to open that...
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:
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
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:
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
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.