SQL Update Syntax

thandel
thandel used Ask the Experts™
on
Would like to update all the values  in a table (tOffice) to False (-1) for the field name "Courier"

I've tried some variations of this SQL command without luck

DoCmd.RunSQL "UPDATE toffice SET Courier  =  -1

Courier is a yes/no variable.

What is wrong with my syntax?  Should I be using an SQL update for this?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
SQL Server DBA & Architect, EE Solution Guide
Awarded 2009
Distinguished Expert 2018
Commented:
>> Courier is a yes/no variable.

If that is the case, then valid values are 1 for YES and 0 for NO.
Kindly change the value to 0 to get it work..
UPDATE toffice SET Courier  =  0

Open in new window

NorieAnalyst Assistant
Commented:
-1 is actually the equivalent of Yes/True.

If you want to set the Courier field to No/False use 0.
DoCmd.RunSQL "UPDATE toffice SET Courier  =  0"

Open in new window

Author

Commented:
Thanks!
NorieAnalyst Assistant

Commented:
No problem, by the way you can actually use No/False.
DoCmd.RunSQL "UPDATE toffice SET Courier  =  No"

Open in new window


DoCmd.RunSQL "UPDATE toffice SET Courier  =  False"

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial