Solved

Error on results page - Microsoft VBScript compilation error

Posted on 2013-01-09
3
320 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 119

Assisted Solution

by:Rey Obrero
Rey Obrero 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now