By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,661 Members | 1,808 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,661 IT Pros & Developers. It's quick & easy.

Null values in query

P: n/a
I have a form that has a drop down box on it which allows the user to
select a YEAR. If the user makes a selection I have a subform that is
driven by a query that will select the YEAR that the user picked. If
the user does not select a year I want to find all items on the
underlying subform. There are Null YEARs in the data base.

I thought if I had my query either select the YEAR picked or "*" it
would find everything, but I guess "*" does not find Null values.

I'm sure it's something simple that I'm just not thinking of, but
how do I have the underlying query select everything is the YEAR
dropdown is empty?

Thanks

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Presumably you have criteria in your query that looks something like this:
[Forms].[Form1].[txtYear]

Switch the query to SQL View (View menu), and change the WHERE clause to
something like this:
([MyYear] Is Null) OR ([MyYear] = [Forms].[Form1].[txtYear]
where "MyYear" represents the name of your field.

I suggest you don't use YEAR as a field name: there is a Year() function in
VBA, and so code can get confused about what you are talking about.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"mar10" <ma****@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I have a form that has a drop down box on it which allows the user to
select a YEAR. If the user makes a selection I have a subform that is
driven by a query that will select the YEAR that the user picked. If
the user does not select a year I want to find all items on the
underlying subform. There are Null YEARs in the data base.

I thought if I had my query either select the YEAR picked or "*" it
would find everything, but I guess "*" does not find Null values.

I'm sure it's something simple that I'm just not thinking of, but
how do I have the underlying query select everything is the YEAR
dropdown is empty?

Thanks

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.