Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2004

    Unanswered: Syntax Error again!! I'm going nuts!

    Guys - here is my latest problem. I have this SQL statement and it says I have a syntax error. I have looked at this thing for 15min and can't see it. I hope one of you can. Thanks!

    SQL2 = "UPDATE [-- DM: Purchase] SET [Actual Price]= '0' WHERE [Purchase].[Product Name]= 'Book - NC 03 Exec Sum' AND WHERE [Purchase].[Product Name] = 'National Conf. 11/03' "


  2. #2
    Join Date
    Feb 2004
    Is this T-SQL or Jet-SQL (Are you using a .mdb or a .adp file?)?

    Are you setting the property of a control in VB such as the recordsource? or are you looking to execute that statement?

    Does it tell you where the Syntax error is occuring? Sometimes it says "Syntax Error near..." That usually helps.

    Another option that may help is add a
    debug.print SQL2
    immediately after you create the string and it will show you exactly what is being passed (in the Immediate Window) and can usually help you identify problems with spaces or incorrect quotation marks.

  3. #3
    Join Date
    Sep 2003
    The extremely Royal borough of Kensington, London
    For all SQL Statements:

    WHERE condition1 AND condition2
    Bessie Braddock: Winston, you are drunk!
    Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

  4. #4
    Join Date
    Feb 2004
    What are the "--" for in the field name right after UPDATE?

    I don't know about JET SQL, but in T-SQL they mean a comment, maybe they are causing your problems.

    ....oh, I just reread R123456's post, and I think he's right. There is only 1 WHERE clause per statement, just add the multiple conditions connected with the proper operators (AND, OR, etc.)

Posting Permissions

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