<All> first item in combo box list

  • Thread starter Thread starter Gary Schuldt
  • Start date Start date
G

Gary Schuldt

I am working to set up a QueryByForm. It has several selection parameters
on it, many of which are combo boxes. Each combo box has a record source
which is a table containing the values I want to drop down.

The idea is that the user would select one parameter per combo box
reflecting what data they wanted to display; then they click cmdQuery and
all's well in the world.

I can't figure out how to display something like <All> as the first entry in
the combo box list, which would signal essentially a "*" search criterion
(i.e., any value for this parameter).

So far I've got it set up so that, when the Form is run, all the combo boxes
come up with a blank (nothing selected) initial value. But once I drop down
the box and select an item from the list, the blank is not there any more.

My work-around is just to delete a non-blank selected item (it's unbound
anyway), but that seems *really inelegant*.

Any suggestions?

Gary
 
You can achieve this by using a UNION query as the
RowSource for the comboBox e.g.

SELECT "<ALL>" FROM {yourTable}
UNION
SELECT {yourColumn} FROM {yourTable}

Hope That Helps
Gerlad Stnaley MCSD
 
Gerald,

looks like a "trick" to me. Never would've thought of selecting a
"constant" out of a table that doesn't contain it!

Thanks,

Gary
 
No trick. Selecting constants is fairly usual within UNION
queries as you often need to know from which part of the
union a particular entry came from. So you would usually
see SQL along the lines of

SELECT 1 as recType, {rest of Select}
UNION
SELECT 2, {rest of Select}
etc

Hope That Helps
Gerald Stanley MCSD
 
Back
Top