Using an Asterisk Wildcard in a combo box

P

PD

I have a combo box "MONTH" as input for a query. The QBE criteria is

"Like [Forms]![Reporting]![SELECTMONTH]"

I set default value of the combo box to "*" and it works (retrieves all
months) the first time, but if I select a month from the combo box and then
try to reselect the "*" it won't allow me too.

Any ideas?

TKS
 
R

Rob Parker

To make this work, you must have the * available in the RowSource of the
combobox. The standard way of doing that (assuming that your combobox is
using a query as its RowSource) is to change the existing query to a Union
query which will include the *. So, rather than a RowSource such as

SELECT DISTINCT MyMonth FROM MyTable;

You would use:

SELECT MyMonth FROM MyTable
UNION
SELECT "*" FROM MyTable;

Note that the UNION eliminates duplicates, so the DISTINCT clause is not
needed.

HTH,

Rob
 
N

NetworkTrade

'default value' probably isn't in play once someone selects a value in a
combobox...

you say then that you 'select *'... and "it won't let you"....is there an
error message? do you have a * embedded in the table that the combobox is
reading?

you are probably closer than you think....since the query is getting the
comboboxes criteria; getting the wild card into the underlying record source
of the combobox is one way to go...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top