Forums
This topic is locked
help with dates and forms
Posted 12 Aug 2004 23:55:16
1
has voted
12 Aug 2004 23:55:16 Dan Berdusco posted:
Hello,I am attempting to create a page to search for specific events by date. My search form has a start date text field (txtStart) and an end date field (txtEnd). The idea is to have the user fill in a start and end date, and the search results will show all events in between these search dates. This seemed easy enough but for some reason it is not working. I have tried using a few different SQL statements but none of them seem to work:
------------------------------------------
<pre id=code><font face=courier size=2 id=code> SELECT *
FROM tblEvents
WHERE eventDates >= varStartDate AND eventDate <= varCloseDate
ORDER BY eventDate ASC </font id=code></pre id=code>
<b>OR</b>
<pre id=code><font face=courier size=2 id=code> SELECT *
FROM tblEvents
WHERE eventDates BETWEEN varStartDate AND eventDate
ORDER BY eventDate ASC </font id=code></pre id=code>
varStartDate = request.form("txtStart"

varCloseDate = request.form("txtEnd"

-----------------------------------------
This seems like it should return results, but it does not. I get no error, just no results.
<b>One thing that I did notice is that the data being posted from the form is like this: </b>
txtStart=08%2F11%2F2004&txtEnd=08%2F19%2F2004 - So, it seems to be submitting a "%2f" rather than an actual "/" when it submits the date. Has anyone ever ran into this before? Could this be the problem? Can you help me?
Any help is appreciated.
Thanks in advance...
Edited by - flexman44 on 12 Aug 2004 23:56:16
Replies
Replied 13 Aug 2004 20:33:48
13 Aug 2004 20:33:48 Dan Berdusco replied:
Nevermind, I figured it out... I needed the # around the date variables.
<pre id=code><font face=courier size=2 id=code>SELECT *FROM tblEventsWHERE eventDates BETWEEN #varStartDate# AND #eventDate#
ORDER BY eventDate ASC
varStartDate = request.form("txtStart"
varCloseDate = request.form("txtEnd"
</font id=code></pre id=code>
Edited by - flexman44 on 13 Aug 2004 20:34:20
<pre id=code><font face=courier size=2 id=code>SELECT *FROM tblEventsWHERE eventDates BETWEEN #varStartDate# AND #eventDate#
ORDER BY eventDate ASC
varStartDate = request.form("txtStart"

varCloseDate = request.form("txtEnd"

</font id=code></pre id=code>
Edited by - flexman44 on 13 Aug 2004 20:34:20