View Single Post
  #5  
Old May 12th, 2010, 10:46 PM posted to microsoft.public.access.queries
Chrissy
external usenet poster
 
Posts: 93
Default Query and date selection

Thanks, John.

I test on the StartDate, future only. So I entered...

Date() And (DateSerial(Year([StartDate]),4,1) Or DateSerial(Year([StartDate]),11,15))


This resulted, like what I was using, current year only.

What do I do about all future dates falling in this range in any future
year?

Thanks,



--
Chrissy


"John W. Vinson" wrote:

On Wed, 12 May 2010 12:43:01 -0700, Chrissy
wrote:

I test to see if a reservation begins between 11/15-3/31 of any year.

So far I have come up with, for the reservation begin date:

Between #11/15/2009# And #12/31/2009# Or Between #1/1/2009# And #3/31/2009#

This, of course, only tests for 2009. Can I use a year wildcard? Is there
a better way?

Thanks in advance,


Dates aren't stored as strings, so wildcards aren't appropriate. I'd suggest
using the DateSerial function to map the date to this year's date:

WHERE
DateSerial(Year(Date()), Month([reservationdate]),Day([reservationdate]))
BETWEEN #11/15# AND #12/31#
OR
DateSerial(Year(Date()), Month([reservationdate]), Day([reservationdate]))
BETWEEN #1/1# AND #3/31#;
--

John W. Vinson [MVP]


.