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

Add "ALL" to combo box

2
How do I add "ALL" (as the top choicce) in a drop down combo box in Access? (combo box only has one field)
Jan 17 '08 #1
5 25050
missinglinq
3,532 Expert 2GB
Replace your combobox RowSource with this

Expand|Select|Wrap|Line Numbers
  1. SELECT YourField FROM YourTable
  2. UNION SELECT "<All>" FROM YourTable; 
filling in your actual field and table names.

Then use this code in the AfterUpdate of your combobox, once again filling in the actual name of your combobox:
Expand|Select|Wrap|Line Numbers
  1. Private Sub YourCombobox_AfterUpdate()
  2.   If Me.YourCombobox = "<All>" Then 
  3.     'Place code here to address selction of <All> 
  4.   End If
  5. End Sub
Welcome to TheScripts!

Linq ;0)>
Jan 17 '08 #2
puppydogbuddy
1,923 Expert 1GB
How do I add "ALL" (as the top choicce) in a drop down combo box in Access? (combo box only has one field)
To add All in the droplist of an unbound combobox, replace the RowSource property of the combobox with the following SQL string, replacing "yourComboColumn with the actual column name in your application.:
Expand|Select|Wrap|Line Numbers
  1. SELECT YourComboColumn As Filter, YourComboColumn FROM YourTable
  2. UNION SELECT "*" As Filter ," All" As YourComboColumn FROM YourTable
  3. ORDER BY YourComboColumn;
  4.  
The union query will generate 2 columns, the first is to be used as the bound (hidden) column, and the second will be used as the displayed column.so be sure and set these properties for your combobox:
Columns = 2
Bound Column = 1
Column Widths - 0; 2

Note the space before the letter A in " All".....this is designed so that All will sort as the top choice.in the collation sequence.

Expand|Select|Wrap|Line Numbers
  1. ---Example-------------
  2. SELECT City AS Filter, City FROM tbl_Customers
  3. UNION SELECT '*' AS Filter, "All" AS City FROM tbl_Customers
As a final step, you can set the default value property for the combobox to: * and it will default the combo selection to all if nothing is selected.
Jan 17 '08 #3
tombev
2
Maybe I should mention couple other things--- 1) My combo box is named: cboLEC2; 2) The bound column is: 1; 3) It uses a TAG function; 4) This is the RowSource I currently have: SELECT StatusSheetInfo.LEC FROM StatusSheetInfo GROUP BY StatusSheetInfo.LEC ORDER BY StatusSheetInfo.LEC;
Jan 18 '08 #4
puppydogbuddy
1,923 Expert 1GB
Maybe I should mention couple other things--- 1) My combo box is named: cboLEC2; 2) The bound column is: 1; 3) It uses a TAG function; 4) This is the RowSource I currently have: SELECT StatusSheetInfo.LEC FROM StatusSheetInfo GROUP BY StatusSheetInfo.LEC ORDER BY StatusSheetInfo.LEC;

Here is the way the row source should look if you followed the instructions that I provided you above:
Expand|Select|Wrap|Line Numbers
  1. SELECT LEC As Filter, LEC FROM StatusSheetInfo 
  2. UNION SELECT "*" As Filter ," All" As LEC FROM StatusSheetInfo
  3. GROUP BY StatusSheetInfo.LEC ORDER BY StatusSheetInfo.LEC;
Follow the rest of the instructions above and it should work.
Jan 18 '08 #5
well this is working i would like to know how to filter the data based on the four combobox and rowsource too
Nov 17 '10 #6

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

Similar topics

2
by: Dale Ring | last post by:
Access 2000 I am trying to add "ALL" to a combo that is used to filter a query. When "ALL" is selected no records show instead of ALL records showing. I have setup a "dummy" table (tblDum)...
1
by: Loreen | last post by:
I have been going through user groups and forums for the past 3 hours trying to figure out how to add "all" to my combo boxes. I've got two unbound comboboxes. Once only has one field...
3
by: tobhamlet | last post by:
If one is using a query as a Row Source on a Form, is there a way to set up a blank space, or to insert the word "ALL" in a combo box that represents ALL combo box row items. The scenario is as...
0
by: Greg Strong | last post by:
Hello All, In the past I've used a combo box with the 'row source' being an Access SQL union query to select "All" or 1 for only 1 criteria in a query. An example is as follows: SELECT 0 As...
4
by: meganrobertson22 | last post by:
Hi Everyone- I have a question about how to add and then use the "All" selection in a combo box. I am trying to figure out how to: (1) add "All" as a selection to a combo box and then (2)...
6
by: Mark | last post by:
I first read about this in mvps.org, but the code he gives doesn't seem to work for my form. I"ll post my code below. I'd love it if someone could point out the error in my code. BTW, this is my...
3
by: Jimmy | last post by:
I use a combo box to filter the results of a form. Sql for combo box is... SELECT StatusPriority, Status FROM tblStatus UNION Select = 0 as AllChoice, "Show All" as Bogus From tblStatus ORDER...
3
Zwoker
by: Zwoker | last post by:
Hi Everyone, I have a query that uses criteria from combo boxes in the form that runs it. When I had only discrete values in the combo boxes that matched the data that was being queried, the...
1
by: StuartD | last post by:
I have a sub form that is populated based on the selection of a year from a combo box on the main form. I'm trying to add a second main form combo box for item category to further filter the sub...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
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.