Results 1 to 3 of 3

Thread: Syntax Error?

  1. #1
    Join Date
    Jun 2004
    Posts
    11

    Exclamation Unanswered: Syntax Error?

    Help!I run this VBA code and it says that i have a syntax error and that i am missing an operand. ANy ideas?

    SQL = ("UPDATE [Product]" & _
    " SET [Product Name] = Forms![-- DM: Product].[Product Name]" & _
    "[Product Type] = Forms![-- DM: Product].[ProductTypeCombo]" & _
    "[Program Type] = Forms![-- DM: Product].[ProgramTypeCombo]" & _
    "[Basic Price] = Forms![-- DM: Product].[Basic]" & _
    "[Team Price] =Forms![-- DM: Product].[Team]" & _
    "[Early Bird Price] = Forms![-- DM: Product].[Early Bird]" & _
    "[Other Price] = Forms![-- DM: Product].[Other]" & _
    "[Retail Price] = Forms![-- DM: Product].[Retail]" & _
    "[Production Date] = Forms![-- DM: Product].[Production Date]" & _
    "[Production End Date] = Forms![-- DM: Product].[Production End Date]" & _
    "[Date Entered] = Forms![-- DM: Product].[Date Entered]" & _
    "[Date Last Modified] = Forms![-- DM: Product].[Date Last Modified]" & _
    " WHERE [Product Name] = Forms![-- DM: Product].[Product Name]")

    thanks!

  2. #2
    Join Date
    Mar 2004
    Posts
    34
    The best way I know to debug such a long sentence is just to delete parts of it until it works then work your way back on writing those lines..
    If at the most minimal sentence you still have a problem then you probably missed some meaningful char..

  3. #3
    Join Date
    Oct 2003
    Posts
    706
    Here's what I do:

    (1) Build the SQL-string up one statement at a time. You don't need to concatenate a godawful string together. The computer don't care; people do!

    (2) Put line-numbers in it. When an exception occurs, the error-line shows you the most recent line-number encountered. You're not using them in a goto statement so you don't need to label every one, but now you can have error messages that tell you very closely where the error is.
    ChimneySweep(R): fast, automatic
    table repair at a click of the
    mouse! http://www.sundialservices.com

Posting Permissions

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