Help with null or inserting <All> into cascading combo boxes please ...

sp00kster

New Member
Joined
Nov 25, 2006
Messages
42
Being honest here I have not opened up a database for over 25 years and feel I have as much understanding as a dishwasher right now - lol

I have a search form using some cascading comboboxes and need to return all records if left null or a viable <All> option. My first combobox that I am stuck on- "cboYear" my current row source = "SELECT DISTINCT CustomerSpecDb.InstallYear FROM CustomerSpecDb;" I have read numerous articles about strictly a VB approach others about inserting a union into the row source and yet trying to apply anything seems to leave me with either a empty dropdown selection or a visable <All> that does not pass on any records when selected

Thanks for your patience and time reading this - any help is much appreciated
Larry
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Building the combo rowsource is easier enough. That just uses the UNION you mentioned.
It is what you do with the ALL option that matters?

One way might be to have a default SQl string "Select * FROM tablename" and you set that as the recordsource for the subform or where you want the data.?
If the combo value is not ALL then add " WHERE fieldname = '"& Me.combo& "'" and then set the recordsource?

Another way might be to use the Like operator on the field to compare

Code:
Like "*" & [descparam] & "*"
and if empty it will produce all records?.

HTH
 
Upvote 0
Following on what welshgasman said, when I want an 'all' option, I set the first row of the combobox to "*" so that I can reference it in the queries directly like the other options.

Users seem to instinctively understand the meaning well-enough.
 
Upvote 0
Thanks for the responses - Please forgive my ignornance but I am not still not exactly clear on how to apply what you are saying to do. Looks like much much more studying
 
Upvote 0
See if this helps.


There are links to get the code to inspect.

Lots of tutorials on YouTube.
 
Upvote 0

Forum statistics

Threads
1,213,487
Messages
6,113,937
Members
448,534
Latest member
benefuexx

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top