Query Expression to run only when Value Entered

  • Thread starter Thread starter orbojeff
  • Start date Start date
O

orbojeff

I'm using a value from an unbound Form Combo Box to limit my Query.

I'm using this expression to limit by City
Like "*" & [Forms]![frm_Search]![cmb_CITY ]& "*"

My Table contains many rows with Null Values for this Field
When I use the above expression the query does not show rows with null
values even when the Form Combo Box value is Null.

I need a query expression that will run only when there is a value in
the Form Combo Box.
If there is a value in the Form Combo Box then limit to that value
If the Form Combo Box is Null do nothing and return all rows
 
orbojeff said:
I'm using a value from an unbound Form Combo Box to limit my Query.

I'm using this expression to limit by City
Like "*" & [Forms]![frm_Search]![cmb_CITY ]& "*"

My Table contains many rows with Null Values for this Field
When I use the above expression the query does not show rows with null
values even when the Form Combo Box value is Null.

I need a query expression that will run only when there is a value in
the Form Combo Box.
If there is a value in the Form Combo Box then limit to that value
If the Form Combo Box is Null do nothing and return all rows

Try...

= [Forms]![frm_Search]![cmb_CITY ] OR [Forms]![frm_Search]![cmb_CITY ] Is Null

(assuming the only reason you were using "*" was to deal with no entry in the
form).
 

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

Back
Top