If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
SQL syntax help please
Hi all
I had an update sql statement working setting a value to true (boolean field) on a set condition, but I am now trying to update a 2nd field also which is text type and I can't seem to get the syntax right. I get 'expected end of statement' message. Code is: strSQL = "UPDATE [qry Resource Planning VVs] " & _ "SET [Selected] = True & _ "[Activity] = '"VV"', " & _ "WHERE Territory_Code = " & """" & txtTerritory & """" Can anyone please help correct this? Thanks... |
#2
|
|||
|
|||
SQL syntax help please
hi Sue,
On 01.03.2010 12:45, Sue wrote: I get 'expected end of statement' message. Code is: strSQL = "UPDATE [qry Resource Planning VVs] "& _ "SET [Selected] = True& _ "[Activity] = '"VV"', "& _ "WHERE Territory_Code = "& """"& txtTerritory& """" There is a comma missing and the quotation marks are also wrong: strSQL = _ "UPDATE [qry Resource Planning VVs] " & _ "SET [Selected] = True, " & _ "[Activity] = 'VV' " & _ "WHERE [Territory_Code] = '" & Replace(txtTerritory, "'", "''") & "'" mfG -- stefan -- |
#3
|
|||
|
|||
SQL syntax help please
Sue wrote:
Hi all I had an update sql statement working setting a value to true (boolean field) on a set condition, but I am now trying to update a 2nd field also which is text type and I can't seem to get the syntax right. I get 'expected end of statement' message. Code is: strSQL = "UPDATE [qry Resource Planning VVs] " & _ "SET [Selected] = True & _ "[Activity] = '"VV"', " & _ "WHERE Territory_Code = " & """" & txtTerritory & """" Can anyone please help correct this? Thanks... Maybe "SET [Selected] = True " & _ (missing closing quote). Mike |
#4
|
|||
|
|||
SQL syntax help please
Thanks Stefan that sorted it :-). I changed the quotes and added the comma.
I left the where clause alone though as this was working ok before. Thanks again for the help!! "Stefan Hoffmann" wrote in message ... hi Sue, On 01.03.2010 12:45, Sue wrote: I get 'expected end of statement' message. Code is: strSQL = "UPDATE [qry Resource Planning VVs] "& _ "SET [Selected] = True& _ "[Activity] = '"VV"', "& _ "WHERE Territory_Code = "& """"& txtTerritory& """" There is a comma missing and the quotation marks are also wrong: strSQL = _ "UPDATE [qry Resource Planning VVs] " & _ "SET [Selected] = True, " & _ "[Activity] = 'VV' " & _ "WHERE [Territory_Code] = '" & Replace(txtTerritory, "'", "''") & "'" mfG -- stefan -- |
#5
|
|||
|
|||
SQL syntax help please
hi Sue,
On 01.03.2010 14:58, Sue wrote: Thanks Stefan that sorted it :-). I changed the quotes and added the comma. I left the where clause alone though as this was working ok before. Thanks again for the help!! Just enter a " in your txtTerritory before executing your code. Test it... mfG -- stefan -- |
#6
|
|||
|
|||
SQL syntax help please
"Sue" wrote in message ... Hi all I had an update sql statement working setting a value to true (boolean field) on a set condition, but I am now trying to update a 2nd field also which is text type and I can't seem to get the syntax right. I get 'expected end of statement' message. Code is: strSQL = "UPDATE [qry Resource Planning VVs] " & _ "SET [Selected] = True & _ "[Activity] = '"VV"', " & _ "WHERE Territory_Code = " & """" & txtTerritory & """" Can anyone please help correct this? Thanks... |
#7
|
|||
|
|||
SQL syntax help please
kjkjkjk
"Sue" a écrit dans le message de groupe de discussion : ... Hi all I had an update sql statement working setting a value to true (boolean field) on a set condition, but I am now trying to update a 2nd field also which is text type and I can't seem to get the syntax right. I get 'expected end of statement' message. Code is: strSQL = "UPDATE [qry Resource Planning VVs] " & _ "SET [Selected] = True & _ "[Activity] = '"VV"', " & _ "WHERE Territory_Code = " & """" & txtTerritory & """" Can anyone please help correct this? Thanks... |
Thread Tools | |
Display Modes | |
|
|