By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,039 Members | 1,831 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,039 IT Pros & Developers. It's quick & easy.

Stuck with an "Expected end of statement" error

P: n/a
Hello All

I was wondering if someone could offer a rather inexperienced person
some advice.

Im trying to get my asp page to look at an access data

I created the following query in access and it worked running it in
access.
However when i paste it into the asp page i get an "Expected end of
statement"

The code is as follows
++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++
Dim strSQL
strSQL = "SELECT DISTINCT tblEventType.strEventTypeDescription,
tblEvent.strEventName "
strSQL = StrSQL & "FROM tblEventType INNER JOIN (tblVenue INNER JOIN "
strSQL = StrSQL & "(tblEvent INNER JOIN tblLINKVenue_Event ON
tblEvent.lngEventID = tblLINKVenue_Event.lngEventID) "
strSQL = StrSQL & "ON tblVenue.lngVenueID =
tblLINKVenue_Event.lngVenueID) ON "
strSQL = StrSQL & "tblEventType.lngEventTypeID =
tblEvent.lngEventTypeID "
strSQL = StrSQL & "WHERE
(((tblEventType.strEventTypeDescription)="Birthday s")) "
strSQL = StrSQL & "ORDER BY tblEvent.strEventName"
strSQL = StrSQL & ";"
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++

When i remove
__________________________________________________ _____________________
strSQL = StrSQL & "WHERE
(((tblEventType.strEventTypeDescription)="Birthday s")) "
__________________________________________________ _____________________

It doesnt give this error and outputs records from the database
Can anyone see why this line is causing the error

Thanks in advance
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
You've got a problem with your quotes. You need either:

strSQL = StrSQL & "WHERE
(((tblEventType.strEventTypeDescription)=""Birthda ys"")) "

or

strSQL = StrSQL & "WHERE
(((tblEventType.strEventTypeDescription)='Birthday s')) "
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"NeilH" <ne**********@ntlworld.com> wrote in message
news:75**************************@posting.google.c om...
Hello All

I was wondering if someone could offer a rather inexperienced person
some advice.

Im trying to get my asp page to look at an access data

I created the following query in access and it worked running it in
access.
However when i paste it into the asp page i get an "Expected end of
statement"

The code is as follows
++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++
Dim strSQL
strSQL = "SELECT DISTINCT tblEventType.strEventTypeDescription,
tblEvent.strEventName "
strSQL = StrSQL & "FROM tblEventType INNER JOIN (tblVenue INNER JOIN "
strSQL = StrSQL & "(tblEvent INNER JOIN tblLINKVenue_Event ON
tblEvent.lngEventID = tblLINKVenue_Event.lngEventID) "
strSQL = StrSQL & "ON tblVenue.lngVenueID =
tblLINKVenue_Event.lngVenueID) ON "
strSQL = StrSQL & "tblEventType.lngEventTypeID =
tblEvent.lngEventTypeID "
strSQL = StrSQL & "WHERE
(((tblEventType.strEventTypeDescription)="Birthday s")) "
strSQL = StrSQL & "ORDER BY tblEvent.strEventName"
strSQL = StrSQL & ";"
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++

When i remove
__________________________________________________ _____________________
strSQL = StrSQL & "WHERE
(((tblEventType.strEventTypeDescription)="Birthday s")) "
__________________________________________________ _____________________

It doesnt give this error and outputs records from the database
Can anyone see why this line is causing the error

Thanks in advance

Nov 13 '05 #2

P: n/a
ne**********@ntlworld.com (NeilH) wrote in message news:<75**************************@posting.google. com>...
Hello All

I was wondering if someone could offer a rather inexperienced person
some advice.

Im trying to get my asp page to look at an access data

I created the following query in access and it worked running it in
access.
However when i paste it into the asp page i get an "Expected end of
statement"

The code is as follows
++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++
Dim strSQL
strSQL = "SELECT DISTINCT tblEventType.strEventTypeDescription,
tblEvent.strEventName "
strSQL = StrSQL & "FROM tblEventType INNER JOIN (tblVenue INNER JOIN "
strSQL = StrSQL & "(tblEvent INNER JOIN tblLINKVenue_Event ON
tblEvent.lngEventID = tblLINKVenue_Event.lngEventID) "
strSQL = StrSQL & "ON tblVenue.lngVenueID =
tblLINKVenue_Event.lngVenueID) ON "
strSQL = StrSQL & "tblEventType.lngEventTypeID =
tblEvent.lngEventTypeID "
strSQL = StrSQL & "WHERE
(((tblEventType.strEventTypeDescription)="Birthday s")) "
strSQL = StrSQL & "ORDER BY tblEvent.strEventName"
strSQL = StrSQL & ";"
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++

When i remove
__________________________________________________ _____________________
strSQL = StrSQL & "WHERE
(((tblEventType.strEventTypeDescription)="Birthday s")) "
__________________________________________________ _____________________

It doesnt give this error and outputs records from the database
Can anyone see why this line is causing the error

Thanks in advance

Really easy. You can't use double quotes inside your SQL statement
because double-quotes are string delimiters in VB/VBA. So you need to
change this:

(((tblEventType.strEventTypeDescription)="Birthday s")) "

to this:

(((tblEventType.strEventTypeDescription)='Birthday s')) "

Notice the _single_ quotes around the literal text, 'Birthdays'.
Nov 13 '05 #3

P: n/a
Thanks for the help

worked a treat

One down one to go!!!
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.