Like Date Parameter

G

Guest

Hello,
I have a parameter that uses
Between [Forms]![frmMaster]![BeginDate] And [Forms]![frmMaster]![EndDate]
The problem is: I don't want the dates to be required. Is there a way to
tell my query to ignore the dates?
My query uses 8 other parameters that come from this form that use Like.
Thanks,
Melinda
 
K

Ken Snell [MVP]

Assuming that, by "ignore" the dates, you mean that the form's controls may
be empty for the dates? One way to do this would be this criterion
expression:

Between Nz([Forms]![frmMaster]![BeginDate],0) And
Nz([Forms]![frmMaster]![EndDate],Date())
 
G

Guest

Hi Ken - this is extremely useful and I have used this in my query - thanks,
I was wondering if there is a version of this that would make the last date
inclusive? - at the moment I have to go a day further in last date parameter.

Thanks for your advice
--
Kind Regards

Hazel


Ken Snell said:
Assuming that, by "ignore" the dates, you mean that the form's controls may
be empty for the dates? One way to do this would be this criterion
expression:

Between Nz([Forms]![frmMaster]![BeginDate],0) And
Nz([Forms]![frmMaster]![EndDate],Date())

--

Ken Snell
<MS ACCESS MVP>

Melinda said:
Hello,
I have a parameter that uses
Between [Forms]![frmMaster]![BeginDate] And [Forms]![frmMaster]![EndDate]
The problem is: I don't want the dates to be required. Is there a way to
tell my query to ignore the dates?
My query uses 8 other parameters that come from this form that use Like.
Thanks,
Melinda
 
G

Gary Walter

Hi Hazel,

I think you are asking for:
= Nz([Forms]![frmMaster]![BeginDate],0) And
< Nz([Forms]![frmMaster]![EndDate],Date()+1)

"huzzlepuzzle"wrote
Hi Ken - this is extremely useful and I have used this in my query -
thanks,
I was wondering if there is a version of this that would make the last
date
inclusive? - at the moment I have to go a day further in last date
parameter.

Thanks for your advice
--
Kind Regards

Hazel


Ken Snell said:
Assuming that, by "ignore" the dates, you mean that the form's controls
may
be empty for the dates? One way to do this would be this criterion
expression:

Between Nz([Forms]![frmMaster]![BeginDate],0) And
Nz([Forms]![frmMaster]![EndDate],Date())

--

Ken Snell
<MS ACCESS MVP>

Melinda said:
Hello,
I have a parameter that uses
Between [Forms]![frmMaster]![BeginDate] And
[Forms]![frmMaster]![EndDate]
The problem is: I don't want the dates to be required. Is there a way
to
tell my query to ignore the dates?
My query uses 8 other parameters that come from this form that use
Like.
Thanks,
Melinda
 
V

Van T. Dinh

Hazel

Small variation from Gary's response and use whichever suitable for you:
= Nz( [Forms]![frmMaster]![BeginDate], 0 ) And
< IIf( IsNull([Forms]![frmMaster]![EndDate]),
DateAdd( "d", 1, Date() ),
DateAdd( "d", 1, [Forms]![frmMaster]![EndDate] ) )

--
HTH
Van T. Dinh
MVP (Access)


Gary Walter said:
Hi Hazel,

I think you are asking for:
= Nz([Forms]![frmMaster]![BeginDate],0) And
< Nz([Forms]![frmMaster]![EndDate],Date()+1)
 
G

Gary Walter

Yup...completely forgot about incrementing
non-null ending date..

Thanks Van!

gary

Van T. Dinh said:
Hazel

Small variation from Gary's response and use whichever suitable for you:
= Nz( [Forms]![frmMaster]![BeginDate], 0 ) And
< IIf( IsNull([Forms]![frmMaster]![EndDate]),
DateAdd( "d", 1, Date() ),
DateAdd( "d", 1, [Forms]![frmMaster]![EndDate] ) )

--
HTH
Van T. Dinh
MVP (Access)


Gary Walter said:
Hi Hazel,

I think you are asking for:
= Nz([Forms]![frmMaster]![BeginDate],0) And
< Nz([Forms]![frmMaster]![EndDate],Date()+1)
 

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