Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error with SQL...

Status
Not open for further replies.

dodgyone

Technical User
Jan 26, 2001
431
GB
I keep on getting the error:

'===============================
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
'===============================

My code is as follows:

'===============================
description = Trim(Request("Description"))

etc etc

ElseIf Request.QueryString("task") = "description" Then
mySQL = "SELECT * FROM [Worklist] WHERE [Worklist].[Description] LIKE '%' & cstr(description) & '%'"
End If

objRS.Open mySQL, objConn
'===============================

I'm using various search forms on the first page to call varying sql statements on the search results page depending upon the variable being passed over in the hyperlink. Not sure what is wrong with the SQL!

Also how do you use SQL to search for a date or time? (i.e. 28 November 2001 or 17:01. Can't work out how it's done..!)

Thanks.
 
I think the problem I am having is to do with the variable that is being passed over.

I am using the hyperlink as follows:

SearchProcess.asp?task=date

Then in the opened search result page I use:

task = request.querystring("task")

to grab the variable and interpret it to display the screen in a certain fashion by useing If amd ElseIf statements.

Is this the right way to do it because it does not seem to be working!

Hope this expands on what I have put down earlier!

Thank you...

 
More ideas... thinking out aloud!

Would I use session variables to pass over this value?

Session("Value") = Variable

...or are there other methods?

Thanks...
 
I would do this before trying to open the recordset:

response.write(mySQL)

Then you'll be able to see what you're trying to execute and even put it over in the query analyzer to get a more coherent error message.

If it's still not clear, then post back with the output of that statement, and someone here could help more.

paul
penny.gif
penny.gif
 
i also see a problem with your sql statement syntax, unless it's just a typo in writing it to this forum:

LIKE '%' & cstr(description) & '%'"

should be

LIKE '% & cstr(description) & %'"

(dropping the single quotes i put in red above)
 
The SQL works fine now thanks.. it's just the passing over of the variable... as discussed above.

It doesn't seem to work either way as amentioned!

Thank you...
 
Sorry but I just cannot seem to get this working. The problem is that I can't bring over both the querystring in the hyperlink and the form details.

So...

There's a form with a description text box in it and when the search button is pressed the form set to GET and the hyperlink address + ?task=testing.

On the receiving page is:
<%

task = Request.QueryString(&quot;task&quot;)

'*****Description search form criteria*****
Description = Request(&quot;Description&quot;)

%>

It only brings over the description and will not display the task. But task will display if description if commented out in the code.

Any advice from the experts appreciated...

Thanks for the efforts so far to get me on the right track ;o)
 
if you set your form method to post, you can still include your task=testing in the querystring of the form action.

can you post your <form> tag here so we can see if there's any syntax errors in it?
 
*****************************************
This is a long one. I hope someone can help me solve this problem! On my search page is:
*****************************************

<html>

<head>
<title>New Page 1</title>
</head>

<body>

<p align=&quot;center&quot;>
<b><font face=&quot;Arial&quot; size=&quot;5&quot;>Work List Search Features</font></b>
</p>

<div align=&quot;center&quot;>
<center>

<table width=&quot;448&quot;>
<tr>
<td width=&quot;440&quot; align=&quot;center&quot;>
<b><font face=&quot;Arial&quot; size=&quot;5&quot;><BR></font></b>

<% If Request.QueryString(&quot;option&quot;) = &quot;date&quot; Then %>

<div align=&quot;center&quot;>
<center>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; width=&quot;445&quot; height=&quot;229&quot;>
<tr>
<td width=&quot;439&quot; height=&quot;227&quot;>
<form method=&quot;GET&quot; action=&quot;SearchProcess.asp?task=date&quot;>
<div align=&quot;center&quot;>
<table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; width=&quot;306&quot; height=&quot;75&quot; bgcolor=&quot;#C0C0C0&quot; bordercolorlight=&quot;#808080&quot; bordercolordark=&quot;#808080&quot; bordercolor=&quot;#808080&quot;>
<tr>
<td width=&quot;300&quot; height=&quot;73&quot;>
<p align=&quot;center&quot;>
<BR>
<font size=&quot;2&quot; face=&quot;Arial&quot;><b>Search based upon a particular date</b></font>
<p align=&quot;center&quot;><select size=&quot;1&quot; name=&quot;StartDay1&quot;>
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>06</option>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<option>24</option>
<option>25</option>
<option>26</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option>
<option>31</option>
</select> <select size=&quot;1&quot; name=&quot;StartMonth1&quot;>
<option>January</option>
<option>February</option>
<option>March</option>
<option>April</option>
<option>May</option>
<option>June</option>
<option>July</option>
<option>August</option>
<option>September</option>
<option>October</option>
<option>November</option>
<option>December</option>
</select> <select size=&quot;1&quot; name=&quot;StartYear1&quot;>
<option>2001</option>
<option>2002</option>
<option>2003</option>
<option>2004</option>
<option>2005</option>
</select>
<p align=&quot;center&quot;><input type=&quot;submit&quot; value=&quot;Search&quot; name=&quot;Search1&quot;><BR><font color=&quot;#C0C0C0&quot;>make
line</font></td>
</tr>
</table>
</div>
<p align=&quot;center&quot;>&nbsp;<a href=&quot;Search.asp?option=blank&quot;><font face=&quot;Arial&quot; size=&quot;2&quot;>Back
to Work List Search Features</font></a></p>
</form>
<p>&nbsp;</td>
</tr>
</table>
</center>
</div>

<% ElseIf Request.QueryString(&quot;option&quot;) = &quot;twodates&quot; Then %>

<div align=&quot;center&quot;>
<center>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; width=&quot;445&quot; height=&quot;229&quot;>
<tr>
<td width=&quot;439&quot; height=&quot;227&quot;>
<form method=&quot;GET&quot; action=&quot;SearchProcess.asp?task=twodates&quot;>
<div align=&quot;center&quot;>
<table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; width=&quot;306&quot; height=&quot;75&quot; bgcolor=&quot;#C0C0C0&quot; bordercolorlight=&quot;#808080&quot; bordercolordark=&quot;#808080&quot; bordercolor=&quot;#808080&quot;>
<tr>
<td width=&quot;300&quot; height=&quot;73&quot;>
<p align=&quot;center&quot;>
<BR>
<font size=&quot;2&quot; face=&quot;Arial&quot;><b>Search based between two dates</b></font>
<p align=&quot;center&quot;><font face=&quot;Arial&quot; size=&quot;2&quot;>&nbsp;from</font> <select size=&quot;1&quot; name=&quot;StartDay2&quot;>
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>06</option>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<option>24</option>
<option>25</option>
<option>26</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option>
<option>31</option>
</select> <select size=&quot;1&quot; name=&quot;StartMonth2&quot;>
<option>January</option>
<option>February</option>
<option>March</option>
<option>April</option>
<option>May</option>
<option>June</option>
<option>July</option>
<option>August</option>
<option>September</option>
<option>October</option>
<option>November</option>
<option>December</option>
</select> <select size=&quot;1&quot; name=&quot;StartYear3&quot;>
<option>2001</option>
<option>2002</option>
<option>2003</option>
<option>2004</option>
<option>2005</option>
</select>
<BR> <font face=&quot;Arial&quot;> <b><BR> </b> </font>&nbsp;<font size=&quot;2&quot; face=&quot;Arial&quot;>until</font>
<select size=&quot;1&quot; name=&quot;EndDay1&quot;>
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>06</option>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<option>24</option>
<option>25</option>
<option>26</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option>
<option>31</option>
</select> <select size=&quot;1&quot; name=&quot;EndMonth1&quot;>
<option>January</option>
<option>February</option>
<option>March</option>
<option>April</option>
<option>May</option>
<option>June</option>
<option>July</option>
<option>August</option>
<option>September</option>
<option>October</option>
<option>November</option>
<option>December</option>
</select> <select size=&quot;1&quot; name=&quot;EndYear1&quot;>
<option>2001</option>
<option>2002</option>
<option>2003</option>
<option>2004</option>
<option>2005</option>
</select> <p align=&quot;center&quot;><input type=&quot;submit&quot; value=&quot;Search&quot; name=&quot;Search2&quot;><BR><font color=&quot;#C0C0C0&quot;>make
line</font></td>
</tr>
</table>
</div>
<p align=&quot;center&quot;>&nbsp;<a href=&quot;Search.asp?option=blank&quot;><font face=&quot;Arial&quot; size=&quot;2&quot;>Back
to Work List Search Features</font></a></p>
</form>
<p>&nbsp;</td>
</tr>
</table>
</center>
</div>

<% ElseIf Request.QueryString(&quot;option&quot;) = &quot;time&quot; Then %>

<div align=&quot;center&quot;>
<center>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; width=&quot;445&quot; height=&quot;229&quot;>
<tr>
<td width=&quot;439&quot; height=&quot;227&quot;>
<form method=&quot;GET&quot; action=&quot;SearchProcess.asp?task=time&quot;>
<div align=&quot;center&quot;>
<table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; width=&quot;306&quot; height=&quot;75&quot; bgcolor=&quot;#C0C0C0&quot; bordercolorlight=&quot;#808080&quot; bordercolordark=&quot;#808080&quot; bordercolor=&quot;#808080&quot;>
<tr>
<td width=&quot;300&quot; height=&quot;73&quot;>
<p align=&quot;center&quot;>
<BR>
<font size=&quot;2&quot; face=&quot;Arial&quot;><b>Search based upon a time</b></font>
<p align=&quot;center&quot;>&nbsp;&nbsp; <b><font face=&quot;Arial&quot;><select size=&quot;1&quot; name=&quot;StartHours1&quot;>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
</select><font size=&quot;4&quot;>:</font><font size=&quot;2&quot; face=&quot;Arial&quot;><select size=&quot;1&quot; name=&quot;StartMinutes1&quot;>
<option>00</option>
<option>05</option>
<option>10</option>
<option>15</option>
<option>20</option>
<option>25</option>
<option>30</option>
<option>35</option>
<option>40</option>
<option>45</option>
<option>50</option>
<option>55</option>
</select><BR></font><BR> </font></b>&nbsp;&nbsp; <input type=&quot;submit&quot; value=&quot;Search&quot; name=&quot;Search3&quot;><BR><font color=&quot;#C0C0C0&quot;>make
line</font></td>
</tr>
</table>
</div>
<p align=&quot;center&quot;>&nbsp;<a href=&quot;Search.asp?option=blank&quot;><font face=&quot;Arial&quot; size=&quot;2&quot;>Back
to Work List Search Features</font></a></p>
</form>
<p>&nbsp;</td>
</tr>
</table>
</center>
</div>


<% ElseIf Request.QueryString(&quot;option&quot;) = &quot;datetime&quot; Then %>

<div align=&quot;center&quot;>
<center>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; width=&quot;445&quot; height=&quot;229&quot;>
<tr>
<td width=&quot;439&quot; height=&quot;227&quot;>
<form method=&quot;GET&quot; action=&quot;SearchProcess.asp?task=datetime&quot;>
<div align=&quot;center&quot;>
<table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; width=&quot;306&quot; height=&quot;75&quot; bgcolor=&quot;#C0C0C0&quot; bordercolorlight=&quot;#808080&quot; bordercolordark=&quot;#808080&quot; bordercolor=&quot;#808080&quot;>
<tr>
<td width=&quot;300&quot; height=&quot;73&quot;>
<p align=&quot;center&quot;>
<BR>
<font size=&quot;2&quot; face=&quot;Arial&quot;><b>Search based upon a date &amp; time</b></font>
<p align=&quot;center&quot;>
<font face=&quot;Arial&quot; size=&quot;2&quot;>on</font> <select size=&quot;1&quot; name=&quot;StartDay3&quot;>
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>06</option>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<option>24</option>
<option>25</option>
<option>26</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option>
<option>31</option>
</select> <select size=&quot;1&quot; name=&quot;StartMonth3&quot;>
<option>January</option>
<option>February</option>
<option>March</option>
<option>April</option>
<option>May</option>
<option>June</option>
<option>July</option>
<option>August</option>
<option>September</option>
<option>October</option>
<option>November</option>
<option>December</option>
</select> <select size=&quot;1&quot; name=&quot;StartYear3&quot;>
<option>2001</option>
<option>2002</option>
<option>2003</option>
<option>2004</option>
<option>2005</option>
</select>
<p align=&quot;center&quot;><font size=&quot;2&quot; face=&quot;Arial&quot;>&nbsp;at</font>&nbsp;
<b><font face=&quot;Arial&quot;><select size=&quot;1&quot; name=&quot;StartHours2&quot;>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
</select><font size=&quot;4&quot;>:</font><font size=&quot;2&quot; face=&quot;Arial&quot;><select size=&quot;1&quot; name=&quot;StartMinutes2&quot;>
<option>00</option>
<option>05</option>
<option>10</option>
<option>15</option>
<option>20</option>
<option>25</option>
<option>30</option>
<option>35</option>
<option>40</option>
<option>45</option>
<option>50</option>
<option>55</option>
</select><BR></font><BR> </font></b>&nbsp;&nbsp; <input type=&quot;submit&quot; value=&quot;Search&quot; name=&quot;Search4&quot;><BR><font color=&quot;#C0C0C0&quot;>make
line</font></td>
</tr>
</table>
</div>
<p align=&quot;center&quot;>&nbsp;<a href=&quot;Search.asp?option=blank&quot;><font face=&quot;Arial&quot; size=&quot;2&quot;>Back
to Work List Search Features</font></a></p>
</form>
<p>&nbsp;</td>
</tr>
</table>
</center>
</div>


<% ElseIf Request.QueryString(&quot;option&quot;) = &quot;name&quot; Then%>

<div align=&quot;center&quot;>
<center>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; width=&quot;445&quot; height=&quot;229&quot;>
<tr>
<td width=&quot;439&quot; height=&quot;227&quot;>
<form method=&quot;GET&quot; action=&quot;SearchProcess.asp?task=name&quot;>
<div align=&quot;center&quot;>
<table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; width=&quot;306&quot; height=&quot;75&quot; bgcolor=&quot;#C0C0C0&quot; bordercolorlight=&quot;#808080&quot; bordercolordark=&quot;#808080&quot; bordercolor=&quot;#808080&quot;>
<tr>
<td width=&quot;300&quot; height=&quot;73&quot;>
<p align=&quot;center&quot;>
<BR>
<font size=&quot;2&quot; face=&quot;Arial&quot;><b>Search based upon Person /
Section</b></font>
<p align=&quot;center&quot;><select size=&quot;1&quot; name=&quot;Name&quot;>
<option value=&quot;ALL&quot;>ALL STAFF - All Staff</option>
<option value=&quot;ADMN&quot;>ADMN - Administration</option>
<option value=&quot;INDR&quot;>INDR - Industrial Relations</option>
<option value=&quot;PERS&quot;>PERS - Personnel</option>
<option value=&quot;TRDT&quot;>TRDT - Training &amp; Development</option>
<option value=&quot;AT&quot;>AT - Abby Tough</option>
<option value=&quot;BPC&quot;>BPC - Brian Castle</option>
<option value=&quot;BW&quot;>BW - Barbara Wynne</option>
<option value=&quot;CJH&quot;>CJH - Chris Hurley</option>
<option value=&quot;CLM&quot;>CLM - Caroline Le Maitre</option>
<option value=&quot;DA&quot;>DA - Dannielle Alder</option>
<option value=&quot;DKR&quot;>DKR - Diane Renouf</option>
<option value=&quot;ET&quot;>ET - Emma Tucker</option>
<option value=&quot;JB&quot;>JB - Jessica Bisson</option>
<option value=&quot;JH&quot;>JH - John Herpe</option>
<option value=&quot;KL&quot;>KL - Kate Lenfestey</option>
<option value=&quot;LP&quot;>LP - Lorraine Pannett</option>
<option value=&quot;LIP&quot;>LIP - Lisa Parnaby</option>
<option value=&quot;MJ&quot;>MJ - Marcus Jehan</option>
<option value=&quot;MN&quot;>MN - Mike Nelson</option>
<option value=&quot;NC&quot;>NC - Niki Carvill</option>
<option value=&quot;SD&quot;>SD - Sarah Dempster</option>
<option value=&quot;SE&quot;>SE - Sian Ellis</option>
<option value=&quot;SLR&quot;>SLR - Sonia Renouf</option>
<option value=&quot;SLS&quot;>SLS - Sarah Le Sauvage</option>
<option value=&quot;SN&quot;>SN - Steve Naftel</option>
<option value=&quot;TH&quot;>TH - Terry Harnden</option>
<option value=&quot;WAS&quot;>WAS - Wendy Smith</option>
</select><b><font face=&quot;Arial&quot;><font size=&quot;2&quot; face=&quot;Arial&quot;><BR></font><BR> </font></b> <input type=&quot;submit&quot; value=&quot;Search&quot; name=&quot;Search5&quot;><BR><font color=&quot;#C0C0C0&quot;>make
line</font></td>
</tr>
</table>
</div>
<p align=&quot;center&quot;>&nbsp;<a href=&quot;Search.asp?option=blank&quot;><font face=&quot;Arial&quot; size=&quot;2&quot;>Back
to Work List Search Features</font></a></p>
</form>
<p>&nbsp;</td>
</tr>
</table>
</center>
</div>

<% ElseIf Request.QueryString(&quot;option&quot;) = &quot;namedate&quot; Then %>

<div align=&quot;center&quot;>
<center>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; width=&quot;445&quot; height=&quot;229&quot;>
<tr>
<td width=&quot;439&quot; height=&quot;227&quot;>
<form method=&quot;GET&quot; action=&quot;SearchProcess.asp?task=namedate&quot;>
<div align=&quot;center&quot;>
<table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; width=&quot;306&quot; height=&quot;75&quot; bgcolor=&quot;#C0C0C0&quot; bordercolorlight=&quot;#808080&quot; bordercolordark=&quot;#808080&quot; bordercolor=&quot;#808080&quot;>
<tr>
<td width=&quot;300&quot; height=&quot;73&quot;>
<p align=&quot;center&quot;>
<BR>
<font size=&quot;2&quot; face=&quot;Arial&quot;><b>Search based upon Person /
Section &amp; Date</b></font>
<p align=&quot;center&quot;><font size=&quot;2&quot; face=&quot;Arial&quot;>For </font><select size=&quot;1&quot; name=&quot;Name2&quot;>
<option value=&quot;ALL&quot;>ALL STAFF - All Staff</option>
<option value=&quot;ADMN&quot;>ADMN - Administration</option>
<option value=&quot;INDR&quot;>INDR - Industrial Relations</option>
<option value=&quot;PERS&quot;>PERS - Personnel</option>
<option value=&quot;TRDT&quot;>TRDT - Training &amp; Development</option>
<option value=&quot;AT&quot;>AT - Abby Tough</option>
<option value=&quot;BPC&quot;>BPC - Brian Castle</option>
<option value=&quot;BW&quot;>BW - Barbara Wynne</option>
<option value=&quot;CJH&quot;>CJH - Chris Hurley</option>
<option value=&quot;CLM&quot;>CLM - Caroline Le Maitre</option>
<option value=&quot;DA&quot;>DA - Dannielle Alder</option>
<option value=&quot;DKR&quot;>DKR - Diane Renouf</option>
<option value=&quot;ET&quot;>ET - Emma Tucker</option>
<option value=&quot;JB&quot;>JB - Jessica Bisson</option>
<option value=&quot;JH&quot;>JH - John Herpe</option>
<option value=&quot;KL&quot;>KL - Kate Lenfestey</option>
<option value=&quot;LP&quot;>LP - Lorraine Pannett</option>
<option value=&quot;LIP&quot;>LIP - Lisa Parnaby</option>
<option value=&quot;MJ&quot;>MJ - Marcus Jehan</option>
<option value=&quot;MN&quot;>MN - Mike Nelson</option>
<option value=&quot;NC&quot;>NC - Niki Carvill</option>
<option value=&quot;SD&quot;>SD - Sarah Dempster</option>
<option value=&quot;SE&quot;>SE - Sian Ellis</option>
<option value=&quot;SLR&quot;>SLR - Sonia Renouf</option>
<option value=&quot;SLS&quot;>SLS - Sarah Le Sauvage</option>
<option value=&quot;SN&quot;>SN - Steve Naftel</option>
<option value=&quot;TH&quot;>TH - Terry Harnden</option>
<option value=&quot;WAS&quot;>WAS - Wendy Smith</option>
</select><p align=&quot;center&quot;><font size=&quot;2&quot; face=&quot;Arial&quot;>on</font>
<select size=&quot;1&quot; name=&quot;StartDay4&quot;>
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>06</option>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<option>24</option>
<option>25</option>
<option>26</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option>
<option>31</option>
</select> <select size=&quot;1&quot; name=&quot;StartMonth4&quot;>
<option>January</option>
<option>February</option>
<option>March</option>
<option>April</option>
<option>May</option>
<option>June</option>
<option>July</option>
<option>August</option>
<option>September</option>
<option>October</option>
<option>November</option>
<option>December</option>
</select> <select size=&quot;1&quot; name=&quot;StartYear4&quot;>
<option>2001</option>
<option>2002</option>
<option>2003</option>
<option>2004</option>
<option>2005</option>
</select>
<b><font face=&quot;Arial&quot;><font size=&quot;2&quot; face=&quot;Arial&quot;><BR></font><BR> </font></b> <input type=&quot;submit&quot; value=&quot;Search&quot; name=&quot;Search6&quot;><BR><font color=&quot;#C0C0C0&quot;>make
line</font></td>
</tr>
</table>
</div>
<p align=&quot;center&quot;>&nbsp;<a href=&quot;Search.asp?option=blank&quot;><font face=&quot;Arial&quot; size=&quot;2&quot;>Back
to Work List Search Features</font></a></p>
</form>
<p>&nbsp;</td>
</tr>
</table>
</center>
</div>


<% ElseIf Request.QueryString(&quot;option&quot;) = &quot;description&quot; Then%>

<div align=&quot;center&quot;>
<center>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; width=&quot;445&quot; height=&quot;229&quot;>
<tr>
<td width=&quot;439&quot; height=&quot;227&quot;>
<form method=&quot;GET&quot; action=&quot;SearchProcess.asp?task=description&quot;>
<div align=&quot;center&quot;>
<table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; width=&quot;306&quot; height=&quot;75&quot; bgcolor=&quot;#C0C0C0&quot; bordercolorlight=&quot;#808080&quot; bordercolordark=&quot;#808080&quot; bordercolor=&quot;#808080&quot;>
<tr>
<td width=&quot;300&quot; height=&quot;73&quot;>
<p align=&quot;center&quot;>
<BR>
<font size=&quot;2&quot; face=&quot;Arial&quot;><b>Search based upon Description</b></font>
<p align=&quot;center&quot;>
<b><font face=&quot;Arial&quot;><font size=&quot;2&quot; face=&quot;Arial&quot;><input type=&quot;text&quot; name=&quot;Description&quot; size=&quot;36&quot;><BR></font><BR> </font></b> <input type=&quot;submit&quot; value=&quot;Search&quot; name=&quot;Search7&quot;><BR><font color=&quot;#C0C0C0&quot;>make
line</font></td>
</tr>
</table>
</div>
<p align=&quot;center&quot;>&nbsp;<a href=&quot;Search.asp?option=blank&quot;><font face=&quot;Arial&quot; size=&quot;2&quot;>Back
to Work List Search Features</font></a></p>
</form>
<p>&nbsp;</td>
</tr>
</table>
</center>
</div>

<%Else%>

<div align=&quot;center&quot;>
<table border=&quot;1&quot; cellspacing=&quot;1&quot; width=&quot;218&quot;>
<tr>
<td align=&quot;center&quot; width=&quot;212&quot;>
<p align=&quot;center&quot;><font size=&quot;3&quot; face=&quot;Arial&quot;><b><BR>Search by: </b></font></p>
<p align=&quot;center&quot;><font face=&quot;Arial&quot; size=&quot;2&quot;><a href=&quot;Search.asp?option=date&quot;>a
particular date</a></font></p>
<p align=&quot;center&quot;><font face=&quot;Arial&quot; size=&quot;2&quot;><a href=&quot;Search.asp?option=twodates&quot;>between
two dates</a></font></p>
<p align=&quot;center&quot;><font face=&quot;Arial&quot; size=&quot;2&quot;><a href=&quot;Search.asp?option=time&quot;>a
particular time</a></font></p>
<p align=&quot;center&quot;><font face=&quot;Arial&quot; size=&quot;2&quot;><a href=&quot;Search.asp?option=datetime&quot;>a
date and a time</a></font></p>
<p align=&quot;center&quot;><font face=&quot;Arial&quot; size=&quot;2&quot;><a href=&quot;Search.asp?option=name&quot;>Person
/ Section Name</a></font></p>
<p align=&quot;center&quot;><font face=&quot;Arial&quot; size=&quot;2&quot;><a href=&quot;Search.asp?option=namedate&quot;>Person
/ Section Name &amp; Date</a></font></p>
<p align=&quot;center&quot;><font face=&quot;Arial&quot; size=&quot;2&quot;><a href=&quot;Search.asp?Option=description&quot;>by
Description</a></font></p>
<p><a href=&quot;test.asp?task=marcus&quot;>test&nbsp;</a></td>
</tr>
</table>
</center>
</div>

<% End If %>
</td>
</tr>
</table>
</div>
<p align=&quot;center&quot;>&nbsp;</p>


</body>

</html>

*****************************************
On my search results page is:
*****************************************

<% task = Request.QueryString(&quot;task&quot;)

'*****Specific Date form criteria*****
StartDay1 = Request.Querystring(&quot;StartDay1&quot;)
StartMonth1 = Request.Querystring(&quot;StartMonth1&quot;)
StartYear1 = Request.Querystring(&quot;StartYear1&quot;)

'*****Betweeen Dates form criteria*****
StartDay2 = Request.Querystring(&quot;StartDay2&quot;)
StartMonth2 = Request.Querystring(&quot;StartMonth2&quot;)
StartYear2 = Request.Querystring(&quot;StartYear2&quot;)
EndDay1 = Request.Querystring(&quot;EndDay1&quot;)
EndMonth1 = Request.Querystring(&quot;EndMonth1&quot;)
EndYear1 = Request.Querystring(&quot;EndYear1&quot;)

'*****Time form criteria*****
StartHours1 = Request.Querystring(&quot;StartHours1&quot;)
StartMinutes1 = Request.Querystring(&quot;StartMinutes1&quot;)

'*****Date & Time form criteria*****
StartDay3 = Request.Querystring(&quot;StartDay3&quot;)
StartMonth3 = Request.Querystring(&quot;StartMonth3&quot;)
StartYear3 = Request.Querystring(&quot;StartYear3&quot;)
StartHours2 = Request.Querystring(&quot;StartHours2&quot;)
StartMinutes2 = Request.Querystring(&quot;StartMinutes2&quot;)

'*****Person Section form criteria*****
Name = Request.Querystring(&quot;Name&quot;)

'*****Person Section & date form criteria*****
Name2 = Request.Querystring(&quot;Name2&quot;)
StartDay4 = Request.Querystring(&quot;StartDay4&quot;)
StartMonth4 = Request.Querystring(&quot;StartMonth4&quot;)
StartYear4 = Request.Querystring(&quot;StartYear4&quot;)

'*****Description search form criteria*****
Description = Request.Querystring(&quot;Description&quot;)

Dim objConn
'open the database using a DSN-less connection
Set objConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
objConn.ConnectionString=&quot;DRIVER={Microsoft Access Driver (*.mdb)};&quot; & _
&quot;DBQ=C:\Documents and Settings\csbexec\My Documents&quot; & _
&quot;\Intranet\Databases\Worklist.mdb&quot;
objConn.Open
%>
<html>

<head>
<title>Work List Search Results Page</title>
<base target=&quot;_self&quot;>
</head>


<%

If task = &quot;date&quot; Then
'mySQL = &quot;SELECT * from [Worklist] WHERE [Worklist].[TimeStart] LIKE StartDateToUse&quot; ORDER BY [DateStart];&quot;
ElseIf task = &quot;twodates&quot; Then

ElseIf task = &quot;time&quot; Then

ElseIf task = &quot;datetime&quot; Then

ElseIf task = &quot;name&quot; Then
mySQL = &quot;SELECT * FROM [Worklist] WHERE [Worklist].[Name] LIKE '% & cstr(name) & %'&quot;
ElseIf task = &quot;namedate&quot; Then

Else If task = &quot;description&quot; Then
mySQL = &quot;SELECT * FROM [Worklist] WHERE [Worklist].[Description] LIKE '% & cstr(Description) & %'&quot;
End If

'create recordset object to retrieve the required data
Set objRS = Server.CreateObject(&quot;ADODB.Recordset&quot;)
objRS.Open mySQL, objConn
%>
<body>
<p align=&quot;center&quot;><b><font size=&quot;4&quot; face=&quot;Arial&quot;>Work List Search Results</font></b>
<BR>
<p align=&quot;center&quot;><font face=&quot;Arial&quot; size=&quot;1 color=&quot;#C0C0C0&quot;>

<%
Do While Not objRS.EOF

'sets the date into the English format for end date
StrDate = DatePart(&quot;d&quot;, objRS(&quot;DateFinish&quot;)) & &quot;/&quot; & _
DatePart(&quot;m&quot;, objRS(&quot;DateFinish&quot;)) & &quot;/&quot; & _
DatePart(&quot;YYYY&quot;, objRS(&quot;DateFinish&quot;))

'joins the date end and the time end fields together
DateTimeJoin = objRS(&quot;TimeFinish&quot;) & &quot; on &quot; & StrDate

'sets the date into the English format for start date
StrDate2 = DatePart(&quot;d&quot;, objRS(&quot;DateStart&quot;)) & &quot;/&quot; & _
DatePart(&quot;m&quot;, objRS(&quot;DateStart&quot;)) & &quot;/&quot; & _
DatePart(&quot;YYYY&quot;, objRS(&quot;DateStart&quot;))

'joins the date end and the time end fields together
DateTimeJoin2 = objRS(&quot;TimeStart&quot;) & &quot; on &quot; & StrDate2
%>
</font></p>
<BR>
<div align=&quot;center&quot;>
<center>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; width=&quot;531&quot;>
<tr>
<td width=&quot;588&quot;>
<div align=&quot;center&quot;>
<div align=&quot;center&quot;>
<table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; width=&quot;495&quot; bordercolor=&quot;#C0C0C0&quot; bordercolorlight=&quot;#C0C0C0&quot; bordercolordark=&quot;#C0C0C0&quot; bgcolor=&quot;#808080&quot;>
<tr>
<td rowspan=&quot;3&quot; width=&quot;67&quot; bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;><b><font size=&quot;2&quot; face=&quot;Arial&quot; color=&quot;#0000FF&quot;>Edit Record</font></b></td>
<td width=&quot;207&quot; bgcolor=&quot;#008000&quot;>
<p align=&quot;center&quot;><font face=&quot;arial&quot; size=&quot;2&quot; color=&quot;#ffffff&quot;><B><% Response.Write DateTimeJoin2 %></B></font></td>
<td width=&quot;209&quot; bgcolor=&quot;#DD0000&quot;>
<p align=&quot;center&quot;><font face=&quot;arial&quot; size=&quot;2&quot; color=&quot;#ffffff&quot;><B><% Response.Write DateTimeJoin %></B></font></td>
</tr>
<tr>
<td width=&quot;205&quot; bgcolor=&quot;#C0C0C0&quot;>
<p align=&quot;center&quot;><font face=&quot;arial&quot; size=&quot;2&quot;><% Response.Write objRS(&quot;Event&quot;) %></font></td>
<td width=&quot;209&quot; bgcolor=&quot;#C0C0C0&quot;>
<p align=&quot;center&quot;><font face=&quot;arial&quot; size=&quot;2&quot;><% Response.Write objRS(&quot;Name&quot;) %></font></td>
</tr>
<tr>
<td width=&quot;414&quot; colspan=&quot;2&quot; bgcolor=&quot;#C0C0C0&quot;>
<div align=&quot;center&quot;>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; width=&quot;418&quot;>
<tr>
<td width=&quot;412&quot;><font face=&quot;Arial&quot; Size=&quot;1&quot;><% Response.Write objRS(&quot;Description&quot;) %></font></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>

<%
'loop through the records until all of the required are displayed
objRS.MoveNext
Loop
%>
</div>
<div align=&quot;center&quot;>
&nbsp;
</div>
</center>
</table>
</body>
<%
'close the connection to the database
objConn.Close
Set objConn = Nothing
%>

*****************************************
Thank you for taking the time and trouble
*****************************************
 
Not all of it posted but you get the idea! On my results page is:

<% task = Request.QueryString(&quot;task&quot;)

'*****Specific Date form criteria*****
StartDay1 = Request.Querystring(&quot;StartDay1&quot;)
StartMonth1 = Request.Querystring(&quot;StartMonth1&quot;)
StartYear1 = Request.Querystring(&quot;StartYear1&quot;)

'*****Betweeen Dates form criteria*****
StartDay2 = Request.Querystring(&quot;StartDay2&quot;)
StartMonth2 = Request.Querystring(&quot;StartMonth2&quot;)
StartYear2 = Request.Querystring(&quot;StartYear2&quot;)
EndDay1 = Request.Querystring(&quot;EndDay1&quot;)
EndMonth1 = Request.Querystring(&quot;EndMonth1&quot;)
EndYear1 = Request.Querystring(&quot;EndYear1&quot;)

'*****Time form criteria*****
StartHours1 = Request.Querystring(&quot;StartHours1&quot;)
StartMinutes1 = Request.Querystring(&quot;StartMinutes1&quot;)

'*****Date & Time form criteria*****
StartDay3 = Request.Querystring(&quot;StartDay3&quot;)
StartMonth3 = Request.Querystring(&quot;StartMonth3&quot;)
StartYear3 = Request.Querystring(&quot;StartYear3&quot;)
StartHours2 = Request.Querystring(&quot;StartHours2&quot;)
StartMinutes2 = Request.Querystring(&quot;StartMinutes2&quot;)

'*****Person Section form criteria*****
Name = Request.Querystring(&quot;Name&quot;)

'*****Person Section & date form criteria*****
Name2 = Request.Querystring(&quot;Name2&quot;)
StartDay4 = Request.Querystring(&quot;StartDay4&quot;)
StartMonth4 = Request.Querystring(&quot;StartMonth4&quot;)
StartYear4 = Request.Querystring(&quot;StartYear4&quot;)

'*****Description search form criteria*****
Description = Request.Querystring(&quot;Description&quot;)

Dim objConn
'open the database using a DSN-less connection
Set objConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
objConn.ConnectionString=&quot;DRIVER={Microsoft Access Driver (*.mdb)};&quot; & _
&quot;DBQ=C:\Documents and Settings\csbexec\My Documents&quot; & _
&quot;\Intranet\Databases\Worklist.mdb&quot;
objConn.Open
%>
<html>

<head>
<title>Work List Search Results Page</title>
<base target=&quot;_self&quot;>
</head>


<%

If task = &quot;date&quot; Then
'mySQL = &quot;SELECT * from [Worklist] WHERE [Worklist].[TimeStart] LIKE StartDateToUse&quot; ORDER BY [DateStart];&quot;
ElseIf task = &quot;twodates&quot; Then

ElseIf task = &quot;time&quot; Then

ElseIf task = &quot;datetime&quot; Then

ElseIf task = &quot;name&quot; Then
mySQL = &quot;SELECT * FROM [Worklist] WHERE [Worklist].[Name] LIKE '% & cstr(name) & %'&quot;
ElseIf task = &quot;namedate&quot; Then

Else If task = &quot;description&quot; Then
mySQL = &quot;SELECT * FROM [Worklist] WHERE [Worklist].[Description] LIKE '% & cstr(Description) & %'&quot;
End If

'create recordset object to retrieve the required data
Set objRS = Server.CreateObject(&quot;ADODB.Recordset&quot;)
objRS.Open mySQL, objConn
%>
<body>
<p align=&quot;center&quot;><b><font size=&quot;4&quot; face=&quot;Arial&quot;>Work List Search Results</font></b>
<BR>
<p align=&quot;center&quot;><font face=&quot;Arial&quot; size=&quot;1 color=&quot;#C0C0C0&quot;>

<%
Do While Not objRS.EOF

'sets the date into the English format for end date
StrDate = DatePart(&quot;d&quot;, objRS(&quot;DateFinish&quot;)) & &quot;/&quot; & _
DatePart(&quot;m&quot;, objRS(&quot;DateFinish&quot;)) & &quot;/&quot; & _
DatePart(&quot;YYYY&quot;, objRS(&quot;DateFinish&quot;))

'joins the date end and the time end fields together
DateTimeJoin = objRS(&quot;TimeFinish&quot;) & &quot; on &quot; & StrDate

'sets the date into the English format for start date
StrDate2 = DatePart(&quot;d&quot;, objRS(&quot;DateStart&quot;)) & &quot;/&quot; & _
DatePart(&quot;m&quot;, objRS(&quot;DateStart&quot;)) & &quot;/&quot; & _
DatePart(&quot;YYYY&quot;, objRS(&quot;DateStart&quot;))

'joins the date end and the time end fields together
DateTimeJoin2 = objRS(&quot;TimeStart&quot;) & &quot; on &quot; & StrDate2
%>
</font></p>
<BR>
<div align=&quot;center&quot;>
<center>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; width=&quot;531&quot;>
<tr>
<td width=&quot;588&quot;>
<div align=&quot;center&quot;>
<div align=&quot;center&quot;>
<table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; width=&quot;495&quot; bordercolor=&quot;#C0C0C0&quot; bordercolorlight=&quot;#C0C0C0&quot; bordercolordark=&quot;#C0C0C0&quot; bgcolor=&quot;#808080&quot;>
<tr>
<td rowspan=&quot;3&quot; width=&quot;67&quot; bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;><b><font size=&quot;2&quot; face=&quot;Arial&quot; color=&quot;#0000FF&quot;>Edit Record</font></b></td>
<td width=&quot;207&quot; bgcolor=&quot;#008000&quot;>
<p align=&quot;center&quot;><font face=&quot;arial&quot; size=&quot;2&quot; color=&quot;#ffffff&quot;><B><% Response.Write DateTimeJoin2 %></B></font></td>
<td width=&quot;209&quot; bgcolor=&quot;#DD0000&quot;>
<p align=&quot;center&quot;><font face=&quot;arial&quot; size=&quot;2&quot; color=&quot;#ffffff&quot;><B><% Response.Write DateTimeJoin %></B></font></td>
</tr>
<tr>
<td width=&quot;205&quot; bgcolor=&quot;#C0C0C0&quot;>
<p align=&quot;center&quot;><font face=&quot;arial&quot; size=&quot;2&quot;><% Response.Write objRS(&quot;Event&quot;) %></font></td>
<td width=&quot;209&quot; bgcolor=&quot;#C0C0C0&quot;>
<p align=&quot;center&quot;><font face=&quot;arial&quot; size=&quot;2&quot;><% Response.Write objRS(&quot;Name&quot;) %></font></td>
</tr>
<tr>
<td width=&quot;414&quot; colspan=&quot;2&quot; bgcolor=&quot;#C0C0C0&quot;>
<div align=&quot;center&quot;>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;1&quot; width=&quot;418&quot;>
<tr>
<td width=&quot;412&quot;><font face=&quot;Arial&quot; Size=&quot;1&quot;><% Response.Write objRS(&quot;Description&quot;) %></font></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>

<%
'loop through the records until all of the required are displayed
objRS.MoveNext
Loop
%>
</div>
<div align=&quot;center&quot;>
&nbsp;
</div>
</center>
</table>
</body>
<%
'close the connection to the database
objConn.Close
Set objConn = Nothing
%>
 
If u want to search for a date u need to place the date between # ie:
select * from tblData where fieldData < #01/01/2001# ________
George, M
 
Sorry for posting so much but this is driving me mad!

1.All I need to do is to pass the variable to a new page by way of a hyperlink set in a form to GET so that thereukst page can use the correct SQL statement:

i.e. SearchProcess.asp?task=description

2.I then wanted to catch this variable in the new page by using:

<%task = Request.QueryString(&quot;task&quot;)%>

3. The problem is that I am also catching form field information as well:

i.e. Description = Request(&quot;Description&quot;)
Name = Request.Querystring(&quot;Name&quot;)

plus many other fields

The problem is that the task in the hyperlink does not seem to transfer over to the results page. I've treid everythng I can think of but not getting very far!

Thanks for being so patient with me...


 
Shouldn't the action of your form then have the actual date in it, rather than the word, 'date' ??

<form method=&quot;GET&quot; action=&quot;SearchProcess.asp?task=date&quot;>

If it's in a server side variable called date, then all you need to do is:

<form method=&quot;GET&quot; action=&quot;SearchProcess.asp?task=<%=date%>&quot;>

Then you're going to want to view your source once the page is rendered to make sure it comes out right.

Another thing that worries me is you're trying to make your own querystring there, and then also use the GET method to send your data.

I suspect that your querystring is simply being overwritten. I don't understand why you could not just use POST for everything, including the date. Stick the date in a hidden form field, and change your method to POST. That would be my suggestion.

But if you still want to use GET, then look at the address bar of the page once you are on the second page to see what was actually passed.

hope that helps. :)
Paul Prewett
penny.gif
penny.gif
 
I echo link9's recommendations. If I had woke up earlier it might've been me saying it. |-I
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top