Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Between two dates conundrum 3

Status
Not open for further replies.

proximity

Technical User
Sep 19, 2002
132
GB
Hi everyone,

I have a table with a DateTime stamp that stores data like this (obviously!): 03/01/07 10:31:08

What I want to do is query this field to display only the data between 01/04/[current year] and 31/03[next year]

So, I want the user to enter a year, say 2006 and the query will show all the records that run from 01/04/2006 to 31/03/2007

Any thoughts on how this can be achieved?

Thanks,

--
Steven
 
Between DateSerial([Enter a year],04,01) And DateSerial(1+[Enter a year],03,31)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I believe you will want to build the whole date parameter in your front end and pass it in.

So you'd have something like this:

Code:
where myDate between #[currentYearDate]# and #[nextYearDate]#

Hope this helps,

Alex

Ignorance of certain subjects is a great part of wisdom
 
As usual, PHV has a better idea :)

Have a
star.gif
buddy!

Ignorance of certain subjects is a great part of wisdom
 
Thanks PHV,

That solution worked beautifully!

--
Steven
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top