Blank Field in Form

  • Thread starter Thread starter Bvdman32
  • Start date Start date
B

Bvdman32

I have a query that gets some criteria (City and State) from a form.
I have the State field set up as a ComboBox connected to a local table
I created. If a user was to type in a City (i.e. "Springfield") and
then leave the State field empty, then the query would have no
results.

How do I make the query so that if one of the fields on the form is
left empty it will run for all possibilities (i.e. look for all
Springfields in any state)?
 
Assuming the name of your form is FrmCityState and there are two textboxes
named City and State on the form, put the following expression in the
criteria of the City field in your query:
Forms!FrmCityState!City Or (Forms!FrmCityState!City IsNull)
and put the following expression in the criteria of the State field in your
query
Forms!FrmCityState!State Or (Forms!FrmCityState!State IsNull)

Steve
(e-mail address removed)
 
Assuming the name of your form is FrmCityState and there are two textboxes
named City and State on the form, put the following expression in the
criteria of the City field in your query:
Forms!FrmCityState!City Or (Forms!FrmCityState!City IsNull)
and put the following expression in the criteria of the State field in your
query
Forms!FrmCityState!State Or (Forms!FrmCityState!State IsNull)

Steve
(e-mail address removed)

I think Steve meant to use

Is Null

rather than

IsNull

since the latter is a VBA function and the former (with the blank) is a valid
SQL criterion.
 
Thank you for correcting my typo, John!

Steve


John W. Vinson said:
I think Steve meant to use

Is Null

rather than

IsNull

since the latter is a VBA function and the former (with the blank) is a
valid
SQL criterion.
 
Back
Top