Error # -2147217900 syntax error
this is my code orginal code which is creating the "Where" part.
Is there another way to get around apostrohpe in a SQL string?
I changed it to this which works in a Select in Powerpoint but in Excel in an Update it does not work.
DougP
this is my code orginal code which is creating the "Where" part.
Is there another way to get around apostrohpe in a SQL string?
Code:
SQLStringLaborUpdateWhere = " Where [Resource name] = [highlight #FCE94F]'" & ResourceName & "'[/highlight] And " & _
"[Cost Tracker] = '" & CostTracker & "';"
which makes this complete SQL string.
Update [Time$] Set [January Labor] = 452.97, [February Labor] = 452.97, [March Labor] = 452.97, [YTD Labor] = 1358.91 Where [Resource name] = [highlight #FCE94F]'O'Mally'[/highlight] And [Cost Tracker] = 'COPD0161';
Code:
SQLStringLaborUpdateWhere = " Where [Resource name] = [highlight #FCE94F][/highlight]" & chr(34) & ResourceName & chr(34) & "[/highlight]" And " & _
"[Cost Tracker] = '" & CostTracker & "';"
Update [Time$] Set [January Labor] = 452.97, [February Labor] = 452.97, [March Labor] = 452.97, [YTD Labor] = 1358.91 Where [Resource name] = "O'Mally" And [Cost Tracker] = 'COPD0161';
DougP