Hi,
With my previous post I got some help and changed the syntex slightly I know get this error. Any suggestions gratefully received, thanks
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'region='brighton' AND WHERE
industry='accounting''.
form code is-
<%
Dim oRSv
Set oRSv=Server.CreateObject("adodb.Recordset"
oRSv.Open "IndustryTable", "dsn=50on"
oRSv.MoveFirst
%>
<form method="post" action="industrysearchregion.asp">
<h5>Select region</h5>
<input type="submit" value="search">
<select name="industry" size="1">
<%
Do While NOT oRSv.EOF
Response.Write "<option value='" & oRSv("industry" & "'>"
Response.Write oRSv("industry" & "</option>"
oRSv.MoveNext
loop
oRSv.Close
Set oRSv=nothing
%>
</select>
<%
Dim oRSr
Set oRSr=Server.CreateObject("adodb.Recordset"
oRSr.Open "RegionTable", "dsn=50on"
oRSr.MoveFirst
%>
<h5>Select region</h5>
<input type="hidden">
<select name="region" size="1">
<%
Do While NOT oRSr.EOF
Response.Write "<option value='" & oRSr("region" & "'>"
Response.Write oRSr("region" & "</option>"
oRSr.MoveNext
loop
oRSr.Close
Set oRSr=nothing
%>
</select>
response page-
<%
varindustry=Request.Form("industry"
varregion=Request.Form("region"
Dim oRS2
dim iRowCounter
Set oRS2=Server.CreateObject("adodb.Recordset"
sSQL="SELECT JobTable.Company, JobTable.industry, JobTable.Jobtitle, JobTable.region"
sSQL=sSQL & " FROM JobTable"
sSQl=sSQL & " WHERE region='" & varregion & "'"
sSQL=sSQL & " AND WHERE industry='" & varindustry & "'"
sSQL=sSQL & " ORDER BY JobTable.Jobtitle;"
oRS2.open sSQL, "DSN=50on"
if oRS2.EOF=True then
Response.write ("Sorry, no jobs were found in this sector"
else oRS2.MoveFirst
response.write "<table bgcolor=Silver valign=top width=500 bordercolordark=Gray border=0>"
response.write "<th bgcolor=white> Job title </th>" & "<th bgcolor=white> Industry </th>" & "<th bgcolor=white>Company</th>" & "<th bgcolor=white> Region </th>"
Do while Not oRS2.EOF
''<a href='" & oRS2 ("ID" & "'>
Response.Write "<tr><td>" & oRS2 ("Jobtitle" & "</td>"
Response.Write "<td>" & oRS2 ("industry" & "</td>"
response.write "<td>" & oRS2 ("Company" & "</td>"
response.write "<td>" & oRS2 ("region" & "</td></tr>"
oRS2.MoveNext
Loop
end if
oRS2.Close
set oRS2=Nothing
response.write "</table>"
%>
With my previous post I got some help and changed the syntex slightly I know get this error. Any suggestions gratefully received, thanks
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'region='brighton' AND WHERE
industry='accounting''.
form code is-
<%
Dim oRSv
Set oRSv=Server.CreateObject("adodb.Recordset"
oRSv.Open "IndustryTable", "dsn=50on"
oRSv.MoveFirst
%>
<form method="post" action="industrysearchregion.asp">
<h5>Select region</h5>
<input type="submit" value="search">
<select name="industry" size="1">
<%
Do While NOT oRSv.EOF
Response.Write "<option value='" & oRSv("industry" & "'>"
Response.Write oRSv("industry" & "</option>"
oRSv.MoveNext
loop
oRSv.Close
Set oRSv=nothing
%>
</select>
<%
Dim oRSr
Set oRSr=Server.CreateObject("adodb.Recordset"
oRSr.Open "RegionTable", "dsn=50on"
oRSr.MoveFirst
%>
<h5>Select region</h5>
<input type="hidden">
<select name="region" size="1">
<%
Do While NOT oRSr.EOF
Response.Write "<option value='" & oRSr("region" & "'>"
Response.Write oRSr("region" & "</option>"
oRSr.MoveNext
loop
oRSr.Close
Set oRSr=nothing
%>
</select>
response page-
<%
varindustry=Request.Form("industry"
varregion=Request.Form("region"
Dim oRS2
dim iRowCounter
Set oRS2=Server.CreateObject("adodb.Recordset"
sSQL="SELECT JobTable.Company, JobTable.industry, JobTable.Jobtitle, JobTable.region"
sSQL=sSQL & " FROM JobTable"
sSQl=sSQL & " WHERE region='" & varregion & "'"
sSQL=sSQL & " AND WHERE industry='" & varindustry & "'"
sSQL=sSQL & " ORDER BY JobTable.Jobtitle;"
oRS2.open sSQL, "DSN=50on"
if oRS2.EOF=True then
Response.write ("Sorry, no jobs were found in this sector"
else oRS2.MoveFirst
response.write "<table bgcolor=Silver valign=top width=500 bordercolordark=Gray border=0>"
response.write "<th bgcolor=white> Job title </th>" & "<th bgcolor=white> Industry </th>" & "<th bgcolor=white>Company</th>" & "<th bgcolor=white> Region </th>"
Do while Not oRS2.EOF
''<a href='" & oRS2 ("ID" & "'>
Response.Write "<tr><td>" & oRS2 ("Jobtitle" & "</td>"
Response.Write "<td>" & oRS2 ("industry" & "</td>"
response.write "<td>" & oRS2 ("Company" & "</td>"
response.write "<td>" & oRS2 ("region" & "</td></tr>"
oRS2.MoveNext
Loop
end if
oRS2.Close
set oRS2=Nothing
response.write "</table>"
%>