|
 |
access_asp thread: Search Using Date Parameters via a textbox on ASP Page
Message #1 by "Susan Sherman" <Susan_Sherman@P...> on Mon, 10 Feb 2003 18:05:46
|
|
I'm new to this board and really looking for a good solution to what would
seem like a simple problem.
I have an access database with a Date field. I would like to search
records in that table by using the date field to set parameters. However,
this only works using a textbox when the Date field property is TEXT. I
need to keep the Date field with DATE property or else other queries won't
work.
In the search results page, I have added the date format to the field
names that I used for the search
dim Field, Search, strSQL, MinDate, MaxDate
'Response.Write Request.Form
Field = Request.Form("Field")
Search = Request.Form("Search")
MinDate = CDate(Request.Form("MinDate"))
MaxDate = CDate(Request.Form("MaxDate"))
*************************************************************************
'Here is the SQL query that I'm using
*************************************************************************
'Shows TNG Ticket History by Date Range
Case "TNGDR"
strSQL= "SELECT Server, Ticket, Open_Date, OpenTime, BriefDescription,
Resolution" & _
"FROM ServerStatus" & _
"WHERE (((Open_Date)='"& MinDate &"')) OR" & _
" (((Open_Date)='"& MaxDate &"'))"
Any suggestions on what I'm doing wrong?
Thanks,
Susie
Message #2 by "Charles Mabbott" <aa8vs@m...> on Mon, 10 Feb 2003 13:24:41 -0500
|
|
Susie,
I am not able to try your statement here to know for sure. But it looks
like you are checking only against the MAX or MIN. Do you want the range in
between also?
Regards,
Chuck
"Whoever said the pen is mightier than the
sword obviously never encountered automatic
weapons."
http://68.43.100.7:81/aa8vs
>From: "Susan Sherman" <Susan_Sherman@P...>
>Reply-To: "Access ASP" <access_asp@p...>
>To: "Access ASP" <access_asp@p...>
>Subject: [access_asp] Search Using Date Parameters via a textbox on ASP
>Page
>Date: Mon, 10 Feb 2003 18:05:46
>
>I'm new to this board and really looking for a good solution to what would
>seem like a simple problem.
>
>I have an access database with a Date field. I would like to search
>records in that table by using the date field to set parameters. However,
>this only works using a textbox when the Date field property is TEXT. I
>need to keep the Date field with DATE property or else other queries won't
>work.
>
>In the search results page, I have added the date format to the field
>names that I used for the search
>
>dim Field, Search, strSQL, MinDate, MaxDate
>'Response.Write Request.Form
>Field = Request.Form("Field")
>Search = Request.Form("Search")
>MinDate = CDate(Request.Form("MinDate"))
>MaxDate = CDate(Request.Form("MaxDate"))
>*************************************************************************
>'Here is the SQL query that I'm using
>*************************************************************************
>'Shows TNG Ticket History by Date Range
>Case "TNGDR"
> strSQL= "SELECT Server, Ticket, Open_Date, OpenTime, BriefDescription,
>Resolution" & _
>"FROM ServerStatus" & _
>"WHERE (((Open_Date)='"& MinDate &"')) OR" & _
>" (((Open_Date)='"& MaxDate &"'))"
>
>Any suggestions on what I'm doing wrong?
>Thanks,
> Susie
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
Message #3 by Susan_Sherman@p... on Mon, 10 Feb 2003 14:04:27 -0500
|
|
Chuck,
Thanks for the response...I may have the SQL statement figured out. Now I
just can't get the data to build in the table.
Here is the code I am using. Now, I'm not getting an error for my sql, I'm
just getting a page that shows:
Zero TNG Tickets were found for dates between "&MinDate&" and "&MaxDate&".
(the dates I put in show up).
Any suggestions. Thanks for your help and your quick response,
Susie
<%
dim Field, Search, strSQL, MinDate, MaxDate
'Response.Write Request.Form
Field = Request.Form("Field")
Search = Request.Form("Search")
MinDate = Request.Form("MinDate")
MaxDate = Request.Form("MaxDate")
'Response.Write "<br>Field: " & Field
'Response.Write "<br>Search: " & Search
Select Case Search
'Shows All Servers TNG Ticket History by Date Range
Case "TNGALL"
strSQL= "SELECT Server, Location, Ticket, Open_Date, OpenTime,
BriefDescription,Resolution " & _
"FROM ServerStatus " & _
"WHERE Open_Date Between ("&MinDate&") And ("&MaxDate&")"
End Select
'Response.Write strSQL
Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=d:
\inetpub\Vdirect\FACTHome\dbfile\Geotel\Geotel.mdb"
Set objRS = Server.CreateObject("ADODB.Recordset")
'************************************************************
'make recordset cursor client-side so you can obtain record count
'************************************************************
With objRS
.CursorType=adOpenStatic
.CursorLocation=adUseClient
.Open strSQL, objConn
End With
'objRS.Open strSQL, objConn
'A counting variable to display the number of records that have
'been found in relation to the selected field.
Dim iRecordCount
iRecordCount=0
'Response.Write strSQL
'Response.Write "<BR>Server: " & objRS("Server") & "<BR>"
'
***********************************************************************************************************
'For All Servers TNG Ticket History between two dates....
If Search="TNGALL" Then
If objRS.RecordCount > 0 Then
Min = Request.Form("MinDate")
Max = Request.Form("MaxDate")
Response.Write "<TABLE align =center valign=tip width=100% border=1
cellspacing=2 cellpadding=2>"
Response.Write "<TR>"
Response.Write "<TH COLSPAN=6><center>Search Results for All TNG
Ticket History: <br> "&Min& " through "&Max& ""
Response.Write "</center></TH>"
Response.Write "</TR>"
Response.Write "<TR>"
Response.Write "<TH>Server Name</TH>"
Response.Write "<TH>Ticket #</TH>"
Response.Write "<TH>Date</TH>"
Response.Write "<TH>Time</TH>"
Response.Write "<TH>Brief Description</TH>"
Response.Write "<TH>Resolution</TH>"
Response.Write "</TR>"
'Response.Write objRS.RecordCount
objRS.MoveFirst
Do While Not objRS.EOF
Response.Write "<TR>"
Response.Write "<TD> " & objRS("Server") & "</TD>"
Response.Write "<TD> " & objRS("Ticket") & "</TD>"
Response.Write "<TD> " & objRS("Open_Date") & "</TD>"
Response.Write "<TD> " & objRS("OpenTime") & "</TD>"
Response.Write "<TD> " & objRS("BriefDescription") & "</TD>"
Response.Write "<TD> " & objRS("Resolution") & "</TD>"
Response.Write "</TR>"
iRecordCount = iRecordCount + 1
objRS.MoveNext
Loop
Response.Write "</TABLE>"
Response.Write "<h3>" & FormatNumber(iRecordCount,0)
Response.Write " record(s) found for TNG Tickets dated between "&MinDate&"
and "&MaxDate&".</h3>"
Else
Response.Write "<h3>Zero TNG Tickets were were found for dates
between "&MinDate&" and "&MaxDate&".</h3>"
End If
End If
'
***********************************************************************************************************
'Response.Write "<center>There were " & FormatNumber(iRecordCount,0)
'Response.Write " record(s) found for this selection.</center>"
%>
<form action="submit.asp" id=form1 name=form1>
<Center><input type="button" value="Print this page" onclick="printPage()"
id=button1 name=button1>
</form>
<h3>Data is available from 01/05/2003 - 02/01/2003</h3>
</BODY>
</HTML>
"Charles
Mabbott" To: "Access ASP" <access_asp@p...>
<aa8vs@m...> cc:
Subject: [access_asp] Re: Search Using Date Parameters via a textbox on ASP Page
02/10/2003 01:24
PM
Please respond
to "Access ASP"
Susie,
I am not able to try your statement here to know for sure. But it looks
like you are checking only against the MAX or MIN. Do you want the range
in
between also?
Regards,
Chuck
"Whoever said the pen is mightier than the
sword obviously never encountered automatic
weapons."
http://68.43.100.7:81/aa8vs
>From: "Susan Sherman" <Susan_Sherman@P...>
>Reply-To: "Access ASP" <access_asp@p...>
>To: "Access ASP" <access_asp@p...>
>Subject: [access_asp] Search Using Date Parameters via a textbox on ASP
>Page
>Date: Mon, 10 Feb 2003 18:05:46
>
>I'm new to this board and really looking for a good solution to what would
>seem like a simple problem.
>
>I have an access database with a Date field. I would like to search
>records in that table by using the date field to set parameters. However,
>this only works using a textbox when the Date field property is TEXT. I
>need to keep the Date field with DATE property or else other queries won't
>work.
>
>In the search results page, I have added the date format to the field
>names that I used for the search
>
>dim Field, Search, strSQL, MinDate, MaxDate
>'Response.Write Request.Form
>Field = Request.Form("Field")
>Search = Request.Form("Search")
>MinDate = CDate(Request.Form("MinDate"))
>MaxDate = CDate(Request.Form("MaxDate"))
>*************************************************************************
>'Here is the SQL query that I'm using
>*************************************************************************
>'Shows TNG Ticket History by Date Range
>Case "TNGDR"
> strSQL= "SELECT Server, Ticket, Open_Date, OpenTime, BriefDescription,
>Resolution" & _
>"FROM ServerStatus" & _
>"WHERE (((Open_Date)='"& MinDate &"')) OR" & _
>" (((Open_Date)='"& MaxDate &"'))"
>
>Any suggestions on what I'm doing wrong?
>Thanks,
> Susie
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
Message #4 by "Charles Mabbott" <aa8vs@m...> on Mon, 10 Feb 2003 15:43:34 -0500
|
|
Susie,
I had a devil of a time on my first data base and some of the things I ran
into were;
First I ended up using the DATA/ TIME format in cell
The text strings I was comparing, I manipulated
until they matched. (leading blank gave me a fit)
The insert statement I used to put data in at first
had a leading blank.
Make sure input date, matches date as stored
I am not sure what you will end up finding but this is some of the things I
tripped over.......
"Whoever said the pen is mightier than the
sword obviously never encountered automatic
weapons."
http://68.43.100.7:81/aa8vs
>From: Susan_Sherman@p...
>Reply-To: "Access ASP" <access_asp@p...>
>To: "Access ASP" <access_asp@p...>
>Subject: [access_asp] Re: Search Using Date Parameters via a textbox on ASP
>Page
>Date: Mon, 10 Feb 2003 14:04:27 -0500
>
>
>Chuck,
>
>Thanks for the response...I may have the SQL statement figured out. Now I
>just can't get the data to build in the table.
>
>Here is the code I am using. Now, I'm not getting an error for my sql, I'm
>just getting a page that shows:
>Zero TNG Tickets were found for dates between "&MinDate&" and "&MaxDate&".
>(the dates I put in show up).
>
>Any suggestions. Thanks for your help and your quick response,
> Susie
>
><%
>dim Field, Search, strSQL, MinDate, MaxDate
>'Response.Write Request.Form
>Field = Request.Form("Field")
>Search = Request.Form("Search")
>MinDate = Request.Form("MinDate")
>MaxDate = Request.Form("MaxDate")
>
>
>'Response.Write "<br>Field: " & Field
>'Response.Write "<br>Search: " & Search
>
>Select Case Search
>
>
> 'Shows All Servers TNG Ticket History by Date Range
> Case "TNGALL"
> strSQL= "SELECT Server, Location, Ticket, Open_Date, OpenTime,
>BriefDescription,Resolution " & _
> "FROM ServerStatus " & _
> "WHERE Open_Date Between ("&MinDate&") And ("&MaxDate&")"
>
>
>End Select
>
>'Response.Write strSQL
>
>
>Dim objConn, objRS
>Set objConn = Server.CreateObject("ADODB.Connection")
> objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=d:
>\inetpub\Vdirect\FACTHome\dbfile\Geotel\Geotel.mdb"
>Set objRS = Server.CreateObject("ADODB.Recordset")
>
>'************************************************************
>'make recordset cursor client-side so you can obtain record count
>'************************************************************
>With objRS
> .CursorType=adOpenStatic
> .CursorLocation=adUseClient
> .Open strSQL, objConn
>End With
>
>'objRS.Open strSQL, objConn
>
>'A counting variable to display the number of records that have
>'been found in relation to the selected field.
>
>Dim iRecordCount
>iRecordCount=0
>
>'Response.Write strSQL
>'Response.Write "<BR>Server: " & objRS("Server") & "<BR>"
>
>'
>***********************************************************************************************************
>'For All Servers TNG Ticket History between two dates....
>If Search="TNGALL" Then
>If objRS.RecordCount > 0 Then
> Min = Request.Form("MinDate")
> Max = Request.Form("MaxDate")
> Response.Write "<TABLE align =center valign=tip width=100% border=1
>cellspacing=2 cellpadding=2>"
> Response.Write "<TR>"
> Response.Write "<TH COLSPAN=6><center>Search Results for All TNG
>Ticket History: <br> "&Min& " through "&Max& ""
> Response.Write "</center></TH>"
> Response.Write "</TR>"
> Response.Write "<TR>"
> Response.Write "<TH>Server Name</TH>"
> Response.Write "<TH>Ticket #</TH>"
> Response.Write "<TH>Date</TH>"
> Response.Write "<TH>Time</TH>"
> Response.Write "<TH>Brief Description</TH>"
> Response.Write "<TH>Resolution</TH>"
> Response.Write "</TR>"
> 'Response.Write objRS.RecordCount
> objRS.MoveFirst
>Do While Not objRS.EOF
> Response.Write "<TR>"
> Response.Write "<TD> " & objRS("Server") & "</TD>"
> Response.Write "<TD> " & objRS("Ticket") & "</TD>"
> Response.Write "<TD> " & objRS("Open_Date") & "</TD>"
> Response.Write "<TD> " & objRS("OpenTime") & "</TD>"
> Response.Write "<TD> " & objRS("BriefDescription") & "</TD>"
> Response.Write "<TD> " & objRS("Resolution") & "</TD>"
> Response.Write "</TR>"
>iRecordCount = iRecordCount + 1
>objRS.MoveNext
>Loop
> Response.Write "</TABLE>"
>Response.Write "<h3>" & FormatNumber(iRecordCount,0)
>Response.Write " record(s) found for TNG Tickets dated between "&MinDate&"
>and "&MaxDate&".</h3>"
>
>Else
> Response.Write "<h3>Zero TNG Tickets were were found for dates
>between "&MinDate&" and "&MaxDate&".</h3>"
>End If
>End If
>'
>***********************************************************************************************************
>'Response.Write "<center>There were " & FormatNumber(iRecordCount,0)
>'Response.Write " record(s) found for this selection.</center>"
>
>%>
>
><form action="submit.asp" id=form1 name=form1>
><Center><input type="button" value="Print this page" onclick="printPage()"
>id=button1 name=button1>
></form>
><h3>Data is available from 01/05/2003 - 02/01/2003</h3>
></BODY>
></HTML>
>
>
>
> "Charles
> Mabbott" To: "Access ASP"
><access_asp@p...>
> <aa8vs@m...> cc:
> Subject: [access_asp] Re:
>Search Using Date Parameters via a textbox on ASP Page
> 02/10/2003 01:24
> PM
> Please respond
> to "Access ASP"
>
>
>
>
>
>
>Susie,
>I am not able to try your statement here to know for sure. But it looks
>like you are checking only against the MAX or MIN. Do you want the range
>in
>between also?
>
>Regards,
>Chuck
>
>
>"Whoever said the pen is mightier than the
>sword obviously never encountered automatic
>weapons."
>
>http://68.43.100.7:81/aa8vs
>
>
>
>
>
> >From: "Susan Sherman" <Susan_Sherman@P...>
> >Reply-To: "Access ASP" <access_asp@p...>
> >To: "Access ASP" <access_asp@p...>
> >Subject: [access_asp] Search Using Date Parameters via a textbox on ASP
> >Page
> >Date: Mon, 10 Feb 2003 18:05:46
> >
> >I'm new to this board and really looking for a good solution to what
>would
> >seem like a simple problem.
> >
> >I have an access database with a Date field. I would like to search
> >records in that table by using the date field to set parameters. However,
> >this only works using a textbox when the Date field property is TEXT. I
> >need to keep the Date field with DATE property or else other queries
>won't
> >work.
> >
> >In the search results page, I have added the date format to the field
> >names that I used for the search
> >
> >dim Field, Search, strSQL, MinDate, MaxDate
> >'Response.Write Request.Form
> >Field = Request.Form("Field")
> >Search = Request.Form("Search")
> >MinDate = CDate(Request.Form("MinDate"))
> >MaxDate = CDate(Request.Form("MaxDate"))
> >*************************************************************************
> >'Here is the SQL query that I'm using
> >*************************************************************************
> >'Shows TNG Ticket History by Date Range
> >Case "TNGDR"
> > strSQL= "SELECT Server, Ticket, Open_Date, OpenTime, BriefDescription,
> >Resolution" & _
> >"FROM ServerStatus" & _
> >"WHERE (((Open_Date)='"& MinDate &"')) OR" & _
> >" (((Open_Date)='"& MaxDate &"'))"
> >
> >Any suggestions on what I'm doing wrong?
> >Thanks,
> > Susie
>
>
>_________________________________________________________________
>Protect your PC - get McAfee.com VirusScan Online
>http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>
>
>
>
>
>
>
_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?page=features/virus
Message #5 by "Ken Schaefer" <ken@a...> on Tue, 11 Feb 2003 10:28:58 +1100
|
|
A couple of things spring to mind.
a) At the moment, you are not sending a string representation of a date,
instead you are sending a numeric expression, which is evaluated to a very
small number which equals some date long ago. E.g. at the moment you have:
<%
MinDate = Request.Form("MinDate")
%>
where MinDate "equals" something like: 11/02/2003. When you send this to the
database like this:
WHERE Open_Date Between (11/02/2003)
you are doing 11 divided by 2 divided by 2003, which is a very small number,
which is equal to 1st January 2003. Instead, you need to use the correct
delimiters to indicate that you have a string representation of a date, ie:
WHERE
Open_Date
BETWEEN #11/02/2003# AND #12/02/2003#
b) Even if you have the correct delimiters, you may be running into problems
with how Access inteprets string representations of dates. See this page for
more details:
www.adopenstatic.com/faq/dateswithaccess.asp
You should format all dates into ISO style format to avoid problems:
yyyy/mm/dd
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: <Susan_Sherman@p...>
To: "Access ASP" <access_asp@p...>
Sent: Tuesday, February 11, 2003 6:04 AM
Subject: [access_asp] Re: Search Using Date Parameters via a textbox on ASP
Page
:
: Chuck,
:
: Thanks for the response...I may have the SQL statement figured out. Now I
: just can't get the data to build in the table.
:
: Here is the code I am using. Now, I'm not getting an error for my sql, I'm
: just getting a page that shows:
: Zero TNG Tickets were found for dates between "&MinDate&" and "&MaxDate&".
: (the dates I put in show up).
:
: Any suggestions. Thanks for your help and your quick response,
: Susie
:
: <%
: dim Field, Search, strSQL, MinDate, MaxDate
: 'Response.Write Request.Form
: Field = Request.Form("Field")
: Search = Request.Form("Search")
: MinDate = Request.Form("MinDate")
: MaxDate = Request.Form("MaxDate")
:
:
: 'Response.Write "<br>Field: " & Field
: 'Response.Write "<br>Search: " & Search
:
: Select Case Search
:
:
: 'Shows All Servers TNG Ticket History by Date Range
: Case "TNGALL"
: strSQL= "SELECT Server, Location, Ticket, Open_Date, OpenTime,
: BriefDescription,Resolution " & _
: "FROM ServerStatus " & _
: "WHERE Open_Date Between ("&MinDate&") And ("&MaxDate&")"
:
:
: End Select
:
: 'Response.Write strSQL
:
:
: Dim objConn, objRS
: Set objConn = Server.CreateObject("ADODB.Connection")
: objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=d:
: \inetpub\Vdirect\FACTHome\dbfile\Geotel\Geotel.mdb"
: Set objRS = Server.CreateObject("ADODB.Recordset")
:
: '************************************************************
: 'make recordset cursor client-side so you can obtain record count
: '************************************************************
: With objRS
: .CursorType=adOpenStatic
: .CursorLocation=adUseClient
: .Open strSQL, objConn
: End With
:
: 'objRS.Open strSQL, objConn
:
: 'A counting variable to display the number of records that have
: 'been found in relation to the selected field.
:
: Dim iRecordCount
: iRecordCount=0
:
: 'Response.Write strSQL
: 'Response.Write "<BR>Server: " & objRS("Server") & "<BR>"
:
: '
:
****************************************************************************
*******************************
: 'For All Servers TNG Ticket History between two dates....
: If Search="TNGALL" Then
: If objRS.RecordCount > 0 Then
: Min = Request.Form("MinDate")
: Max = Request.Form("MaxDate")
: Response.Write "<TABLE align =center valign=tip width=100% border=1
: cellspacing=2 cellpadding=2>"
: Response.Write "<TR>"
: Response.Write "<TH COLSPAN=6><center>Search Results for All TNG
: Ticket History: <br> "&Min& " through "&Max& ""
: Response.Write "</center></TH>"
: Response.Write "</TR>"
: Response.Write "<TR>"
: Response.Write "<TH>Server Name</TH>"
: Response.Write "<TH>Ticket #</TH>"
: Response.Write "<TH>Date</TH>"
: Response.Write "<TH>Time</TH>"
: Response.Write "<TH>Brief Description</TH>"
: Response.Write "<TH>Resolution</TH>"
: Response.Write "</TR>"
: 'Response.Write objRS.RecordCount
: objRS.MoveFirst
: Do While Not objRS.EOF
: Response.Write "<TR>"
: Response.Write "<TD> " & objRS("Server") & "</TD>"
: Response.Write "<TD> " & objRS("Ticket") & "</TD>"
: Response.Write "<TD> " & objRS("Open_Date") & "</TD>"
: Response.Write "<TD> " & objRS("OpenTime") & "</TD>"
: Response.Write "<TD> " & objRS("BriefDescription") & "</TD>"
: Response.Write "<TD> " & objRS("Resolution") & "</TD>"
: Response.Write "</TR>"
: iRecordCount = iRecordCount + 1
: objRS.MoveNext
: Loop
: Response.Write "</TABLE>"
: Response.Write "<h3>" & FormatNumber(iRecordCount,0)
: Response.Write " record(s) found for TNG Tickets dated between "&MinDate&"
: and "&MaxDate&".</h3>"
:
: Else
: Response.Write "<h3>Zero TNG Tickets were were found for dates
: between "&MinDate&" and "&MaxDate&".</h3>"
: End If
: End If
: '
:
****************************************************************************
*******************************
: 'Response.Write "<center>There were " & FormatNumber(iRecordCount,0)
: 'Response.Write " record(s) found for this selection.</center>"
:
: %>
:
: <form action="submit.asp" id=form1 name=form1>
: <Center><input type="button" value="Print this page" onclick="printPage()"
: id=button1 name=button1>
: </form>
: <h3>Data is available from 01/05/2003 - 02/01/2003</h3>
: </BODY>
: </HTML>
:
:
:
: "Charles
: Mabbott" To: "Access ASP"
<access_asp@p...>
: <aa8vs@m...> cc:
: Subject: [access_asp] Re:
Search Using Date Parameters via a textbox on ASP Page
: 02/10/2003 01:24
: PM
: Please respond
: to "Access ASP"
:
:
:
:
:
:
: Susie,
: I am not able to try your statement here to know for sure. But it looks
: like you are checking only against the MAX or MIN. Do you want the range
: in
: between also?
:
: Regards,
: Chuck
:
:
: "Whoever said the pen is mightier than the
: sword obviously never encountered automatic
: weapons."
:
: http://68.43.100.7:81/aa8vs
:
:
:
:
:
: >From: "Susan Sherman" <Susan_Sherman@P...>
: >Reply-To: "Access ASP" <access_asp@p...>
: >To: "Access ASP" <access_asp@p...>
: >Subject: [access_asp] Search Using Date Parameters via a textbox on ASP
: >Page
: >Date: Mon, 10 Feb 2003 18:05:46
: >
: >I'm new to this board and really looking for a good solution to what
would
: >seem like a simple problem.
: >
: >I have an access database with a Date field. I would like to search
: >records in that table by using the date field to set parameters. However,
: >this only works using a textbox when the Date field property is TEXT. I
: >need to keep the Date field with DATE property or else other queries
won't
: >work.
: >
: >In the search results page, I have added the date format to the field
: >names that I used for the search
: >
: >dim Field, Search, strSQL, MinDate, MaxDate
: >'Response.Write Request.Form
: >Field = Request.Form("Field")
: >Search = Request.Form("Search")
: >MinDate = CDate(Request.Form("MinDate"))
: >MaxDate = CDate(Request.Form("MaxDate"))
: >*************************************************************************
: >'Here is the SQL query that I'm using
: >*************************************************************************
: >'Shows TNG Ticket History by Date Range
: >Case "TNGDR"
: > strSQL= "SELECT Server, Ticket, Open_Date, OpenTime, BriefDescription,
: >Resolution" & _
: >"FROM ServerStatus" & _
: >"WHERE (((Open_Date)='"& MinDate &"')) OR" & _
: >" (((Open_Date)='"& MaxDate &"'))"
: >
: >Any suggestions on what I'm doing wrong?
: >Thanks,
: > Susie
:
:
: _________________________________________________________________
: Protect your PC - get McAfee.com VirusScan Online
: http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
:
:
:
:
:
:
:
|
|
 |