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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching with 2 fields or more

Status
Not open for further replies.

rissac

Technical User
May 9, 2003
79
IN
I'm developing a search page for my database and I need to find the results between two field options. I seem to be getting an error everytime I want to search for the results. I using Dreamweaver for asp development. Does anyone have any recommendations? Error below.

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Client.client_ID 14 AND job_act = 'active''.


Link to record set is below.
 
If you show the entire sql statement we can help. From what I can see here it looks like your missing a quote after the word active. Should be:
'Client.client_ID 14 AND job_act = 'active'".
A recommendation would be not to let Dreamweaver write your code if that's what you're doing.
 
Here is the raw code in the HTML document.

<%@LANGUAGE=&quot;VBSCRIPT&quot; CODEPAGE=&quot;1252&quot;%>
<!--#include file=&quot;../Connections/conflex_db.asp&quot; -->
<%
Dim ID__MMColParam
ID__MMColParam = &quot;1&quot;
If (Request.Form(&quot;ysClient&quot;) <> &quot;&quot;) Then
ID__MMColParam = Request.Form(&quot;ysClient&quot;)
End If
%>
<%
Dim ID__ysActivity
ID__ysActivity = &quot;job_act&quot;
If (Request.Form(&quot;ysActivity&quot;) <> &quot;&quot;) Then
ID__ysActivity = Request.Form(&quot;ysActivity&quot;)
End If
%>
<%
Dim ID
Dim ID_numRows

Set ID = Server.CreateObject(&quot;ADODB.Recordset&quot;)
ID.ActiveConnection = MM_conflex_db_STRING
ID.Source = &quot;SELECT * FROM QryMain WHERE Client.client_ID &quot; + Replace(ID__MMColParam, &quot;'&quot;, &quot;''&quot;) + &quot; AND job_act = '&quot; + Replace(ID__ysActivity, &quot;'&quot;, &quot;''&quot;) + &quot;' ORDER BY job_act ASC&quot;
ID.CursorType = 0
ID.CursorLocation = 2
ID.LockType = 1
ID.Open()

 
Your missing the equals operator after ClientID. I put it in in red. Should work now.

&quot;SELECT * FROM QryMain WHERE Client.client_ID [red]=[/red]&quot; + Replace(ID__MMColParam, &quot;'&quot;, &quot;''&quot;) + &quot; AND job_act = '&quot; + Replace(ID__ysActivity, &quot;'&quot;, &quot;''&quot;) + &quot;' ORDER BY job_act ASC&quot;
 
Thank you that fix it. It's always one small thing that is left out. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top