Solved

Error on results page - Microsoft VBScript compilation error

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Storing Combo Box Selection in Table 12 45
Web based Access Database and licencing 5 30
Make query more efficient 1 17
Recordset containing single quotes 8 23
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

895 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

12 Experts available now in Live!

Get 1:1 Help Now