I have a page that has two date fields (for a date range) and a drop down list.
When the page is opened, it defaults to a date range of the last 30 days. The drop down list defaults to "All" so it lists all records for the last month.
The user can change the dates and/or the specific Jurisdiction, select the "Go" button and get a new list.
The only way I could think of to determine if the page was just opened is to check to see if the drop down list has a value. However if they change the dates but don't change the drop down list then it defaults back to the 30 day range.
How else can I determine whether the page is first opened to run some default code?
Here's the code I have:
If JurID = "" then
sDate = DateAdd("m",-1,Now())
StartDate = FormatDateTime(sDate,2)
EndDate = Month(Now) & "/" & Day(Now) & "/" & Year(Now)
sql = " WHERE DateReceived BETWEEN '" & StartDate & "' AND '" & EndDate & "' ORDER BY DateReceived DESC "
else
StartDate = Request("StartDate")
EndDate = Request("EndDate")
sql = " WHERE JurID=" & JurID & " AND DateReceived BETWEEN '" & StartDate & "' AND '" & EndDate & "' ORDER BY DateReceived DESC "
JurID = clng(JurID)
end if
Thanks!
When the page is opened, it defaults to a date range of the last 30 days. The drop down list defaults to "All" so it lists all records for the last month.
The user can change the dates and/or the specific Jurisdiction, select the "Go" button and get a new list.
The only way I could think of to determine if the page was just opened is to check to see if the drop down list has a value. However if they change the dates but don't change the drop down list then it defaults back to the 30 day range.
How else can I determine whether the page is first opened to run some default code?
Here's the code I have:
If JurID = "" then
sDate = DateAdd("m",-1,Now())
StartDate = FormatDateTime(sDate,2)
EndDate = Month(Now) & "/" & Day(Now) & "/" & Year(Now)
sql = " WHERE DateReceived BETWEEN '" & StartDate & "' AND '" & EndDate & "' ORDER BY DateReceived DESC "
else
StartDate = Request("StartDate")
EndDate = Request("EndDate")
sql = " WHERE JurID=" & JurID & " AND DateReceived BETWEEN '" & StartDate & "' AND '" & EndDate & "' ORDER BY DateReceived DESC "
JurID = clng(JurID)
end if
Thanks!