By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,149 Members | 885 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,149 IT Pros & Developers. It's quick & easy.

Problems with UPDATE statement

P: 6
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!! :-)
Jan 23 '17 #1

✓ answered by jforbes

I think you only want to use the SET Keyword once. I'd start with removing the second SET:
Expand|Select|Wrap|Line Numbers
  1. UPDATE [BoQ] SET [BoQ].[ID_Ch] = 16, SET [BoQ].[CHCod] = 'CS01' WHERE [BoQ].[Id] = 16;

Share this Question
Share on Google+
2 Replies


jforbes
Expert 100+
P: 1,107
I think you only want to use the SET Keyword once. I'd start with removing the second SET:
Expand|Select|Wrap|Line Numbers
  1. UPDATE [BoQ] SET [BoQ].[ID_Ch] = 16, SET [BoQ].[CHCod] = 'CS01' WHERE [BoQ].[Id] = 16;
Jan 23 '17 #2

P: 6
WOW!!

Thanks a lot!!! Working now!! :-)
Jan 23 '17 #3

Post your reply

Sign in to post your reply or Sign up for a free account.