View Full Version : Syntax error in string in query expression

01-27-2005, 10:20 PM
I'm using Dreamweaver MX, ASP, and Access to develop a two page survey. After completing page 1, the user clicks Submit. A hidden field passes a session GUID and also inserts that GUID into a field in my Access database which holds the responses. When the browser gets to page 2, it prepares to do an update (to the record already holding the results from page 1) when the user clicks the Submit button. However, before any part of page 2 is displayed, the following error appears:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in string in query expression 'MSGUID = 'C7D38704-47CE-4E14-873D-C0D7A49C5B34}'.
/survey/mapsurvey2.asp, line 139

Can anyone tell me what's wrong with my code?


Dim rsContinueSurvey
Dim rsContinueSurvey_numRows

Set rsContinueSurvey = Server.CreateObject("ADODB.Recordset")
rsContinueSurvey.ActiveConnection = MM_survey_STRING
rsContinueSurvey.Source = "SELECT MSID, MSGUID FROM TblMapSurvey WHERE MSGUID = '" + Replace(rsContinueSurvey__MMColParam, "'", "''") + "'"
rsContinueSurvey.CursorType = 0
rsContinueSurvey.CursorLocation = 2
rsContinueSurvey.LockType = 1

rsContinueSurvey_numRows = 0

01-28-2005, 08:59 PM
I discovered a solution with some help from another forum...

First, I got rid of the


from the


statement in page 2.

Then in page 1 of the survey, I altered the generation of the GUID as such:

MSGUID = Server.CreateObject("Scriptlet.TypeLib").GUID
MSGUID = mid(MSGUID,2,36)

By manipulating the GUID string, I was able to avoid the { and }s altogether.

Probably a better way to do this but it worked.