ASP Coding for finding records in a date range

K

Kingster

I have an access table called Orders. When an order is placed the date is automatically entered. I have it set to ShortDate. When I run a query on Orders for one date, it comes back with the date and the time. I don't care about the time. Yet, it always puts the time in. The field shows as Tue Apr 19 00:00:00 PDT 2005 even though I want just 4/19/2005 so I can query based on that format. Not the date format.

What I want is to be able to query the table for a "date range" using two online form boxes. I'm using Active Server Pages in VBScript. I seem to have to use a LIKE command to get a record to show. That's fine when I'm asking for one date, but how do I access a set of records using "two" dates, since I have to use the LIKE command to get any date. How can I have the date just be the date and not the time so I don't have to use the LIKE command.

How is this done?

Here's the code I have for one date:

<%
Dim rstest
Dim rstest_numRows

Set rstest = Server.CreateObject("ADODB.Recordset")
rstest.ActiveConnection = MM_Romantic_STRING
rstest.Source = "SELECT * FROM Orders WHERE OrderDate LIKE '%" + Replace(rstest__MMColParam, "'", "''") + "%'"
rstest.CursorType = 0
rstest.CursorLocation = 2
rstest.LockType = 1
rstest.Open()

rstest_numRows = 0
%>

Thanks in advance for any insight...

Kingster
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top