PC Review


Reply
Thread Tools Rate Thread

Blank Field in Form

 
 
Bvdman32
Guest
Posts: n/a
 
      28th Dec 2009
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)?
 
Reply With Quote
 
 
 
 
Steve
Guest
Posts: n/a
 
      28th Dec 2009
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 Removed)



"Bvdman32" <(E-Mail Removed)> wrote in message
news:cf84c7f7-5f41-4398-b882-(E-Mail Removed)...
>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)?



 
Reply With Quote
 
John W. Vinson
Guest
Posts: n/a
 
      28th Dec 2009
On Mon, 28 Dec 2009 13:03:31 -0500, "Steve" <(E-Mail Removed)> wrote:

>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 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.

--

John W. Vinson [MVP]
 
Reply With Quote
 
Steve
Guest
Posts: n/a
 
      28th Dec 2009
Thank you for correcting my typo, John!

Steve


"John W. Vinson" <jvinson@STOP_SPAM.WysardOfInfo.com> wrote in message
news:(E-Mail Removed)...
> On Mon, 28 Dec 2009 13:03:31 -0500, "Steve" <(E-Mail Removed)>
> wrote:
>
>>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 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.
>
> --
>
> John W. Vinson [MVP]



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to search for a 'blank' field on a form? Or a 'null' field ? Mel Microsoft Access 2 10th Jul 2007 10:37 PM
Copying a field to the next available blank field on another form? =?Utf-8?B?ZWZhbmRhbmdv?= Microsoft Access Form Coding 11 28th Mar 2007 01:53 AM
Copying a field to the next available blank field on another form? =?Utf-8?B?ZWZhbmRhbmdv?= Microsoft Access VBA Modules 10 28th Mar 2007 01:53 AM
apending data to table from unbound form when form field blank =?Utf-8?B?QXJub2xkIEtsYXBoZWNr?= Microsoft Access VBA Modules 2 16th Aug 2006 09:31 PM
blank form field, but not really Stuart Lee Microsoft Access Forms 1 18th Feb 2004 01:07 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:18 AM.