Parameter Query Not Returning Null Values

M

Melissa

I have a parameter query which prompts the user to "Enter
Class" - which is a 4 digit field reflecting the
graduation year of high school students.

The code I have written into the criteria field of the
query is:
Like [Enter Class] & "*"

I want this same query to work for the following:
1. Pull a select class, such as 2005. This works.
2. Pull all records that have any class entered. This
works.
3.Pull only the records that have no class entered, i.e.
is null. I had thought that just pressing enter when
prompted for "Enter Class" would work; but it doesn't.
4.Pull all records whether Class is null or not. This
doesn't work either.

Thanks in advance for your help.
 
J

John Spencer (MVP)

WHERE [GradYear] Like [Enter Class]
OR [Enter Class] Is Null
Or ([Enter Class] = "Null" and [GradYear] Is Null)

If Enter Class has any valid value "2005", "2004" then this should return the class.
If Enter Class is "*" then this should return all records that are not null
If Enter Class is "Null" then this should return only those records where the
gradYear is null
If Enter Class is Null then this should pull all the records no matter what is
in the GradYear field.

Access will rearrange this into a mess and it may be "Too complex" to run.
 

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

Top