Link to home
Start Free TrialLog in
Avatar of arendt73
arendt73

asked on

Error on results page - Microsoft VBScript compilation error

I am getting the following error message on my results page.  It appears I am missing either a ' or ".  Any assistance is greatly appreciated.  Thank you.


Microsoft VBScript compilation  error '800a0401'

Expected end of statement

sWhere = sWhere & sep & "proc_info LIKE '%" & kw(i) "%'"
-----------------------------------------------------------------------------------^

<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = "Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\inetpub\wwwroot\website\database\db.mdb"

Dim kw()
kw()=Split(Request.Form("search"), " ")

Dim sep
Dim sWhere

sep = "("
Dim i
For i = LBound(kw) to UBound(kw)
    sWhere = sWhere & sep & "proc_info LIKE '%" & kw(i) "%'"
    sep = " OR "

Next 
sWhere = sWhere & ")"

Dim strSQL
strSQL = "SELECT * FROM information " & sWhere

response.write strSQL
response.end

Recordset1.Source= strSQL
Recordset1.CursorType = 0 
Recordset1.CursorLocation = 2 
Recordset1.LockType = 1 
Recordset1.Open()
Recordset1_numRows = 0 
%>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of jerryb30
jerryb30
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial