[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression

Discussion in 'ASP General' started by Darryl, Sep 28, 2005.

  1. Darryl

    Darryl Guest

    I am receiving this error when try to insert a value into the Summary
    field that is formatted in HTML. I am using ASP to connect to an Access
    database. The ASP code for the insert statement is as follows:

    Private Function fInsertRecord()
    sSql = "INSERT INTO Events (Description, TheTime, Location, Event,
    Download, DateOfEvent, Summary) VALUES ("
    sSql = sSql & il("sDescription") & ", "
    sSql = sSql & il("sTheTime") & ", "
    sSql = sSql & il("sLocation") & ", "
    sSql = sSql & il("sEvent") & ", "
    if Request.form("sDownload") = "" then
    StoreValue = "'No'"
    else
    StoreValue = Request.form("sDownload")
    end if
    sSql = sSql & StoreValue & ", "
    sSql = sSql & "#" & Request.form("sDateOfEvent") & "#" & ", "

    if Request.form("sSummary") = "" then
    StoreValue1 = "-----"
    else
    StoreValue1 = Request.form("sSummary")
    end if
    InsertAp(StoreValue1)
    sSql = sSql & "'" & StoreValue1 & "')"

    'response.write(sSql)
    conn.execute(sSql)
    end function

    The response.write produces:

    INSERT INTO Events (Description, TheTime, Location, Event, Download,
    DateOfEvent, Summary) VALUES ('Monthly meeting - Holiday Luncheon',
    '8:00 PM', 'Some location in', 'An Event Title Would Go Here', 'No',
    #01/01/2010#, '

    To comply with U.S. Treasury Regulations, we are required to inform you
    that any tax advice contained in this message or in any attachment is
    not intended to be relied upon, and cannot be relied upon, to avoid
    penalties under the Internal Revenue Code.



    ')

    And the complete error is:

    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

    [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing
    operator) in query expression ''<P><STRONG> </STRONG></P> <P
    class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE:
    10pt; FONT-FAMILY: Arial"><FONT color=#000000>To comply with U.S.
    Treasury Regulations, we are required to inform you that any tax advice
    contained in this mes'.

    /EventEdit.asp, line 405


    Line 405 is the conn.execute(sSql) from above.

    Any thoughts would be greatly appreciated.
    Darryl, Sep 28, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page