Results 1 to 2 of 2

Thread: Access ODBC Syntax Error in Where Clause

  1. #1
    Greg Ivins Guest

    Access ODBC Syntax Error in Where Clause

    I followed one of the online examples for creating the following SQL statement:

    MyDb.dbSQL = "SELECT Member.CompanyName, Member.CompanyLocation, Member.BusinessType, Contacts.ContactName, Contacts.ContactTitle, Contacts.Responsibilities, Contacts.NotInterested, Contacts.Interested FROM Member INNER JOIN Contacts ON Member.UserID = Contacts.UserID WHERE Member.CompanyName = '" & request("Company&#34 & "'"

    My browser shows the following error message:

    Error # = 80040E14
    Description = [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Member.CompanyName = 'Beccy's Tire''.
    Source = Microsoft OLE DB Provider for ODBC Drivers
    SQL State = 37000
    NativeError = -3100

    Any help is greatly appreciated.

  2. #2
    Mark Guest

    Access ODBC Syntax Error in Where Clause (reply)

    Greg,
    Unfortuantely your CompanyName had a single quote in it. That goofed up your WHERE syntax. You must change single quotes to quote-quote BEFORE building up the query string. See Programming Example D5h at http://www.aspdb.com
    Mark.

    ------------
    Greg Ivins at 12/28/99 7:06:05 AM

    I followed one of the online examples for creating the following SQL statement:

    MyDb.dbSQL = "SELECT Member.CompanyName, Member.CompanyLocation, Member.BusinessType, Contacts.ContactName, Contacts.ContactTitle, Contacts.Responsibilities, Contacts.NotInterested, Contacts.Interested FROM Member INNER JOIN Contacts ON Member.UserID = Contacts.UserID WHERE Member.CompanyName = '" & request("Company&#34 & "'"

    My browser shows the following error message:

    Error # = 80040E14
    Description = [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Member.CompanyName = 'Beccy's Tire''.
    Source = Microsoft OLE DB Provider for ODBC Drivers
    SQL State = 37000
    NativeError = -3100

    Any help is greatly appreciated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •