Unanswered: How do I display in combo box from table like this?
I want to display all contents of one column and the word “All” in combo box. So user can select any item from table or select all for table. I know how to display from table, but I don’t know how to display the all in same combo box, anyone can help? thanks a lot
This is possible but a little tricky for beginners.
Part1 : First you need to get a "*" in the list from your combo. It can be done like this :
in the RowSource of the combo, write something like this :
SELECT "*" FROM MyTable UNION SELECT MyTable.MyColumn FROM MyTable;
where of course you substitute MyTable and MyColumn with the appropriate names of your table and column.
This will create the list in your combo, preceeded with a "*".
Part 2 : choosing a value in the combo will probably trigger an event, or the value in the combo is used elsewhere.
Suppose the second option : the chosen value is used to restrict the view in another form with the code
Docmd.OpenForm "frmFormB",,,"FieldB = '" & Me!Combo & "'"
If you change this code into
Docmd.OpenForm "frmFormB",,,"FieldB LIKE '*" & Me!Combo & "'*"
you will get what you want : when the user chose a normal value in the combo, the opened form wil be restricted to this value. When he chose the "*", the opened form will not be restricted.