Combo box or *

T

Tim

I've got a combo box that lists countries; select a
country and the sub form of related info updates to show
records filterd by that country.

The combo box has an SQL statment something like
SELECT CountryID, Country_Name FROM country

Gives all the countries in the list.


Question: How can I add '*' (all) tot he combo, so the
records are shown for all countries? ie you can have
records filterd by country, or you can have the recrds
for all countries?

TIA
Tim
 
N

Nikos Yannacopoulos

Tim,

To add the * option to the combo, change its rowsource SQL statement to:

SELECT CountryID, Country_Name FROM country
UNION SELECT "*","All Countries" FROM country

Then, in the subform RecordSource SQL change the WHRE clause from:
WHERE CountryID = ' " & cboCountryID & " ' "
to
WHERE CountryID Like ' " & cboCountryID & " ' "

i.e. change the = to Like, so * returns all.

HTH,
Nikos
 
T

tim

Nicely done!
Cheers Nik

-----Original Message-----
Tim,

To add the * option to the combo, change its rowsource SQL statement to:

SELECT CountryID, Country_Name FROM country
UNION SELECT "*","All Countries" FROM country

Then, in the subform RecordSource SQL change the WHRE clause from:
WHERE CountryID = ' " & cboCountryID & " ' "
to
WHERE CountryID Like ' " & cboCountryID & " ' "

i.e. change the = to Like, so * returns all.

HTH,
Nikos




.
 

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