I am using a form to define parameters

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using a form to select parameters. I have fields such as [project Nbr]
and [County]. There may be many projects in a county. I would like to be
able to leave the [Project Nbr] null and have the query return all of the
projects in the county.

I am thinking of using a IIf [Project Nbr] is null and have the query ignore
it or make the selection critera "True". What should I put in the selection
critera of the [Project Nbr] field on the query?

I truly appreciate your help.
 
You want your WHERE clause to be somethin like:

WHERE ([project Nbr] = Forms!MyForm!MyControl Or Forms!MyForm!MyControl IS
NULL)

You can do this by putting

Forms!MyForm!MyControl Or Forms!MyForm!MyControl IS NULL

as the criteria in the query builder.
 
Thanks, Doug. Is Doug ok?

I'll give this a try. As I understand the text as shown below (with proper
names) should be placed in the query critera. Regarding the "or", should
this text be typed in a single critera space or should the parts appear on
two seperate critera spaces?

I'll try both. Thanks again for your help.

Douglas J. Steele said:
You want your WHERE clause to be somethin like:

WHERE ([project Nbr] = Forms!MyForm!MyControl Or Forms!MyForm!MyControl IS
NULL)

You can do this by putting

Forms!MyForm!MyControl Or Forms!MyForm!MyControl IS NULL

as the criteria in the query builder.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Bill Cunningham said:
I am using a form to select parameters. I have fields such as [project
Nbr]
and [County]. There may be many projects in a county. I would like to be
able to leave the [Project Nbr] null and have the query return all of the
projects in the county.

I am thinking of using a IIf [Project Nbr] is null and have the query
ignore
it or make the selection critera "True". What should I put in the
selection
critera of the [Project Nbr] field on the query?

I truly appreciate your help.
 

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