View Full Version : Docmd.RunSQL


IanT
06-13-2008, 05:34 AM
Hi

Trying to use this code but it errors on the "Settled", I assume the syntex is incorrect. Can anyone advise

Thanks

DoCmd.RunSQL "UPDATE tblCostProcessedData SET tblCostProcessedData.[Settled?] = "Settled" " & _
"WHERE (((tblCostProcessedData.[Date Costs Agreed]) Is Not Null));"

ecawilkinson
06-13-2008, 05:36 AM
put single quotes around settled instead of double, e.g. 'settled'

DCrake
06-13-2008, 05:45 AM
Your code

DoCmd.RunSQL "UPDATE tblCostProcessedData SET tblCostProcessedData.[Settled?] = "Settled" " & _
"WHERE (((tblCostProcessedData.[Date Costs Agreed]) Is Not Null));"

Can be simplified as below

DoCmd.RunSQL "UPDATE tblCostProcessedData SET [Settled?] = 'Settled' WHERE [Date Costs Agreed] Is Not Null;"

Tow tips

1. Don't use ? marks as part of a field name
2. Don't have spaces between words in field names

CodeMaster::cool: