wer
-----Original Message-----
From: Kingster [mailto:
[email protected]]
Posted At: Wednesday, April 20, 2005 8:38 AM
Posted To: microsoft.public.access
Conversation: How do I query for a date range?
Subject: Re: How do I query for a date range?
This is a multi-part message in MIME format.
------=_NextPart_000_015F_01C5451B.76E21A10
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
John,
I think this is over my head. Yikes...I get all kinds of mismatch =
errors. How much would you charge to write the proper code?
the website is
www.romantic-adventures.com
Thanks...
King
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. =20
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 =3D Server.CreateObject("ADODB.Recordset")
rstest.ActiveConnection =3D MM_Romantic_STRING
rstest.Source =3D "SELECT * FROM Orders WHERE OrderDate LIKE '%" + =
Replace(rstest__MMColParam, "'", "''") + "%'"
rstest.CursorType =3D 0
rstest.CursorLocation =3D 2
rstest.LockType =3D 1
rstest.Open()
rstest_numRows =3D 0
%>
Thanks in advance for any insight...
Kingster
------=_NextPart_000_015F_01C5451B.76E21A10
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2180" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>John,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I think this is over my head. =
Yikes...I get=20
all kinds of mismatch errors. How much would you charge to write =
the=20
proper code?

</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>the website is <A=20
href=3D"
http://www.romantic-adventures.com">
www.romantic-adventures.com</=
A></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>King</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Kingster" <<A=20
=
href=3D"mailto:
[email protected]">
[email protected]</A>>=
wrote=20
in message <A=20
=
href=3D"@TK2MSFTNGP09.phx.gbl</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>I have an access table called =
Orders. When=20
an order is placed the date is automatically entered. I have it =
set to=20
ShortDate. When I run a query on Orders for one date, it comes back =
with the=20
date and the time. I don't care about the time. Yet, it =
always=20
puts the time in. The field shows as Tue Apr 19 =
00:00:00 PDT=20
2005 even though I want just 4/19/2005 so I can query based on that =
format.=20
Not the date format. <BR><BR>What I want is to be able to query =
the=20
table for a "date range" using two online form boxes. I'm using =
Active=20
Server Pages in VBScript. I seem to have to use a LIKE command =
to get a=20
record to show. That's fine when I'm asking for one date, but =
how do I=20
access a set of records using "two" dates, since I have to use the =
LIKE=20
command to get any date. How can I have the date just be the =
date and=20
not the time so I don't have to use the LIKE =
command.</FONT></DIV><FONT=20
face=3DArial size=3D2>
<DIV><BR>How is this done?<BR><BR>Here's the code I have for one =
date:</DIV>
<DIV> </DIV>
<DIV><%<BR>Dim rstest<BR>Dim rstest_numRows</DIV>
<DIV> </DIV>
<DIV>Set rstest =3D=20
Server.CreateObject("ADODB.Recordset")<BR>rstest.ActiveConnection =3D=20
MM_Romantic_STRING<BR>rstest.Source =3D "SELECT * FROM =
Orders WHERE=20
OrderDate LIKE '%" + Replace(rstest__MMColParam, "'", "''") +=20
"%'"<BR>rstest.CursorType =3D 0<BR>rstest.CursorLocation =3D =
2<BR>rstest.LockType=20
=3D 1<BR>rstest.Open()</DIV>
<DIV> </DIV>
<DIV>rstest_numRows =3D 0<BR>%></DIV>
<DIV> </DIV>
<DIV>Thanks in advance for any insight...</DIV>
<DIV> </DIV>
<DIV>Kingster</FONT></DIV></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_015F_01C5451B.76E21A10--