Solved

Error on results page - Microsoft VBScript compilation error

Posted on 2013-01-09
3
322 Views
Last Modified: 2013-01-09
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

0
Comment
Question by:arendt73
3 Comments
 
LVL 26

Accepted Solution

by:
jerryb30 earned 350 total points
ID: 38760488
missing an &?

 sWhere = sWhere & sep & "proc_info LIKE '%" & kw(i)  & "%'"
0
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 100 total points
ID: 38760566
change this

strSQL = "SELECT * FROM information " & sWhere

with


strSQL = "SELECT * FROM information Where " & sWhere
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 50 total points
ID: 38760574
And also (if this is MS Access), try replacing "%" with "*"
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question