Form Combo Box for Query Criteria

  • Thread starter Thread starter Coral G via AccessMonster.com
  • Start date Start date
C

Coral G via AccessMonster.com

Hi Everyone!

I'm trying to build a form where you can pick different options from a combo
box and use that as the criteria in a query that is opened from that form. I
have the combo boxes working correctly, ie. you can pick a choice in the
combo box and the query runs using that criteria in a field. The problem I'm
still having now is that I want to be able to not choose something in the box
and have it return all the records.

To get a little more specific: There are various sites that produce
different items, SITEA SITEB SITEC SITED. The combo box offers you these
choices to limit your query, and if you pick SITEA the query works fine and
returns all the records with a site matching SITEA. However, alternately I
want to be able to not pick a site (leave it null) and have it return with
all records from SITEA SITEB SITEC and SITED. The way I'm doing this right
now is having the combo box referenced as a where in my query, but is there
another way that will work better?

Thanks for any advice!
Coral
 
Hi Everyone!

I'm trying to build a form where you can pick different options from a combo
box and use that as the criteria in a query that is opened from that form. I
have the combo boxes working correctly, ie. you can pick a choice in the
combo box and the query runs using that criteria in a field. The problem I'm
still having now is that I want to be able to not choose something in the box
and have it return all the records.

To get a little more specific: There are various sites that produce
different items, SITEA SITEB SITEC SITED. The combo box offers you these
choices to limit your query, and if you pick SITEA the query works fine and
returns all the records with a site matching SITEA. However, alternately I
want to be able to not pick a site (leave it null) and have it return with
all records from SITEA SITEB SITEC and SITED. The way I'm doing this right
now is having the combo box referenced as a where in my query, but is there
another way that will work better?

Thanks for any advice!
Coral

And the current where clause is ....?

Where (Whatever your current where clause is) OR
[YourComboBox] Is Null
 
As simple as that! I knew it would be something easy, I just couldn't get my
mind around it.

Thanks Fred!
Hi Everyone!
[quoted text clipped - 16 lines]
Thanks for any advice!
Coral

And the current where clause is ....?

Where (Whatever your current where clause is) OR
[YourComboBox] Is Null
 
Back
Top