Problems with UPDATE statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Lirsy
    New Member
    • Jan 2017
    • 6

    Problems with UPDATE statement

    Hi!!

    I am becoming crazy with this update statement:

    Sql_Str = "UPDATE [BoQ] SET [BoQ].[ID_Ch] = " & Lista20.Value & ", SET [BoQ].[CHCod] = '" & DLookup("[Ch].[Ch]", "[Ch]", "[Ch].[Id] = " & Lista20.Value) & "' WHERE [BoQ].[Id] = " & Lista20.Value & ";"

    the debug.print is the following:

    UPDATE [BoQ] SET [BoQ].[ID_Ch] = 16, SET [BoQ].[CHCod] = 'CS01' WHERE [BoQ].[Id] = 16;

    Where table BoQ has fields Id_Ch (Integer) and CHCod (String)

    I already checked and those 16 are really integers.

    Any idea of what happens there??

    Thanks a lot!!

    BTW ... Sorry for the mess in the field names!! I promise I will never put so confusing names again!! :-)
  • jforbes
    Recognized Expert Top Contributor
    • Aug 2014
    • 1107

    #2
    I think you only want to use the SET Keyword once. I'd start with removing the second SET:
    Code:
    UPDATE [BoQ] SET [BoQ].[ID_Ch] = 16, [iCODE]SET[/iCODE] [BoQ].[CHCod] = 'CS01' WHERE [BoQ].[Id] = 16;

    Comment

    • Lirsy
      New Member
      • Jan 2017
      • 6

      #3
      WOW!!

      Thanks a lot!!! Working now!! :-)

      Comment

      Working...