Help needed for "Between Parameter"

  • Thread starter Thread starter Graham
  • Start date Start date
G

Graham

Hello all,
I am using Access2002(XP)
I have a query with a date field and criteria as:
Between [Start Date] And [End Date]
This works fine.
But is there a way to get ALL the dates
without having to enter the First and Last dates
when the query is run.
I thought I would be able to just hit the enter key
when prompted for the dates without entering any dates.
This doesn't work.
Is there any way to do this?
 
Hello all,
I am using Access2002(XP)
I have a query with a date field and criteria as:
Between [Start Date] And [End Date]
This works fine.
But is there a way to get ALL the dates
without having to enter the First and Last dates
when the query is run.
I thought I would be able to just hit the enter key
when prompted for the dates without entering any dates.
This doesn't work.
Is there any way to do this?

Where [DateField] Between [Start Date] and [End Date] Or Like
IIf(IsNull([Start Date])"*")

Don't enter anything in either prompt to get all the records.
 
Or try:
Where [DateField] Between Nz([Start Date], [DateField]) and Nz([End Date]
,[DateField])
This assumes the [DateField] will not be null.

--
Duane Hookom
MS Access MVP


fredg said:
Hello all,
I am using Access2002(XP)
I have a query with a date field and criteria as:
Between [Start Date] And [End Date]
This works fine.
But is there a way to get ALL the dates
without having to enter the First and Last dates
when the query is run.
I thought I would be able to just hit the enter key
when prompted for the dates without entering any dates.
This doesn't work.
Is there any way to do this?

Where [DateField] Between [Start Date] and [End Date] Or Like
IIf(IsNull([Start Date])"*")

Don't enter anything in either prompt to get all the records.
 
Thanks guys,
I'll try them both. I appreciate the responses

Graham


Duane Hookom said:
Or try:
Where [DateField] Between Nz([Start Date], [DateField]) and Nz([End Date]
,[DateField])
This assumes the [DateField] will not be null.

--
Duane Hookom
MS Access MVP


fredg said:
Hello all,
I am using Access2002(XP)
I have a query with a date field and criteria as:
Between [Start Date] And [End Date]
This works fine.
But is there a way to get ALL the dates
without having to enter the First and Last dates
when the query is run.
I thought I would be able to just hit the enter key
when prompted for the dates without entering any dates.
This doesn't work.
Is there any way to do this?

Where [DateField] Between [Start Date] and [End Date] Or Like
IIf(IsNull([Start Date])"*")

Don't enter anything in either prompt to get all the records.
 
Hi Fred,
Just a quick note.
The query grid doesn't allow me to use the star key "*"
Are you able to use it?
 
Hi Fred,
Just a quick note.
The query grid doesn't allow me to use the star key "*"
Are you able to use it?
Where [DateField] Between [Start Date] and [End Date] Or Like
IIf(IsNull([Start Date])"*")

Don't enter anything in either prompt to get all the records.

Yes it does, and the query does return all records if the [Enter
Start] parameter prompt is null.

On the first criteria line for the date field, type:
Between [Start Date] and [End Date]

on the next line down (on the OR criteria line, type
Like IIf(IsNull([Start Date]),"*")

Make sure the parenthesis and punctuation is the same as above.

In SQL View, the code will then read (with the additional parenthesis
that Access throws in:

WHERE (((YourTable.DateField) Between [Start Date] And [End Date])) OR
(((YourTable.DateField) Like IIf(IsNull([Start Date]),"*")));
 

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