Parameter Question

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

Guest

New to Access....

How can I create a parameter in a query, such as a date range to pull data
back in that range or if the parameters are null to pull all records?

Any help would be appreciated. Thanks.
 
Tris I said:
New to Access....

How can I create a parameter in a query, such as a date range to pull data
back in that range or if the parameters are null to pull all records?

Any help would be appreciated. Thanks.

If you mean that some records have null date fields then

Between [Enter start date] And [Enter End date] Or Is Null

If you mean that the user leaves the parameter entry box blank then I think
you'd need to use a form with some code to handle the nulls. I am happy to
be corrected if I am wrong about that :-)

Keith.
www.keithwilby.com
 
I want to be able to prompt the user with beg date and end date and selecting
records between those two dates

or

if the user leaves the prompts blank, then it brings back all records.

I am selecting all records that are not null.

Thanks for your help.

Keith Wilby said:
Tris I said:
New to Access....

How can I create a parameter in a query, such as a date range to pull data
back in that range or if the parameters are null to pull all records?

Any help would be appreciated. Thanks.

If you mean that some records have null date fields then

Between [Enter start date] And [Enter End date] Or Is Null

If you mean that the user leaves the parameter entry box blank then I think
you'd need to use a form with some code to handle the nulls. I am happy to
be corrected if I am wrong about that :-)

Keith.
www.keithwilby.com
 
If you mean you want to select all records where the date is not null then
the following will work for you as long as all your dates are within the
specified range of Jan 1 1799 to Dec 31, 2999

Between Nz([Enter Start Date],#1/1/1799#) And Nz([Enter End
Date],#12/31/2999#)

This also
-- allows the user to enter only a Start Date and get all records on or
after that date.
-- allows the user to enter only an End Date and get all records on or
before that date.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Tris I said:
I want to be able to prompt the user with beg date and end date and
selecting
records between those two dates

or

if the user leaves the prompts blank, then it brings back all records.

I am selecting all records that are not null.

Thanks for your help.

Keith Wilby said:
Tris I said:
New to Access....

How can I create a parameter in a query, such as a date range to pull
data
back in that range or if the parameters are null to pull all records?

Any help would be appreciated. Thanks.

If you mean that some records have null date fields then

Between [Enter start date] And [Enter End date] Or Is Null

If you mean that the user leaves the parameter entry box blank then I
think
you'd need to use a form with some code to handle the nulls. I am happy
to
be corrected if I am wrong about that :-)

Keith.
www.keithwilby.com
 
John,

That is exactly what I want. Thank you very much.

John Spencer said:
If you mean you want to select all records where the date is not null then
the following will work for you as long as all your dates are within the
specified range of Jan 1 1799 to Dec 31, 2999

Between Nz([Enter Start Date],#1/1/1799#) And Nz([Enter End
Date],#12/31/2999#)

This also
-- allows the user to enter only a Start Date and get all records on or
after that date.
-- allows the user to enter only an End Date and get all records on or
before that date.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Tris I said:
I want to be able to prompt the user with beg date and end date and
selecting
records between those two dates

or

if the user leaves the prompts blank, then it brings back all records.

I am selecting all records that are not null.

Thanks for your help.

Keith Wilby said:
New to Access....

How can I create a parameter in a query, such as a date range to pull
data
back in that range or if the parameters are null to pull all records?

Any help would be appreciated. Thanks.

If you mean that some records have null date fields then

Between [Enter start date] And [Enter End date] Or Is Null

If you mean that the user leaves the parameter entry box blank then I
think
you'd need to use a form with some code to handle the nulls. I am happy
to
be corrected if I am wrong about that :-)

Keith.
www.keithwilby.com
 
Back
Top