How do you get around the leap-year issue when selecting a rang of dates
as in my code below. If you enter "2/29" it will error out.
<%
If VarMonth = "February" Then
FromDate = "2/1/" & VarYear
ToDate = "2/28/" & VarYear
Else
VarMonth = Request("SelectMonth")
VarYear = Request("SelectYear")
FromDate = Request("FromDate")
ToDate = Request("ToDate")
End IF
%>
What are you trying to accomplish? I can't tell you "how to get around"
something if I don't know what you want to do.
If you just want to select everything in February then you could do:
(assuming StartDate = 2003/02/01 - 1st Feb
WHERE dateField >= StartDate
AND dateField < DateAdd("m", 1, StartDate)
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Paul Price" <pprice@o...>
Subject: [access_asp] Leap-Year Problem
: How do you get around the leap-year issue when selecting a rang of dates
: as in my code below. If you enter "2/29" it will error out.
:
: <%
: If VarMonth = "February" Then
: FromDate = "2/1/" & VarYear
: ToDate = "2/28/" & VarYear
:
: Else
: VarMonth = Request("SelectMonth")
: VarYear = Request("SelectYear")
: FromDate = Request("FromDate")
: ToDate = Request("ToDate")
:
: End IF
: %>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~