Reputation:
Struggling with an extremely easy issue, however, due to the lack of a more specific error message from ADO, I can't figure it out.
I need to add a new column in a table using SQL, the column type is a YESNO, however, I also want to set it's default value to TRUE|YES or whatever the brilliant engineers thought to name it ... this is what I have:
ALTER TABLE TABLENAME
ADD COLUMN VISIBLE YESNO DEFAULT YES; /* the engine complains, 1 is also not ok, true is not ok, what is OK? */
If I remove everything after default the SQL will be executed as expected...
Thank you!
EDIT:
Just in case someone else hits this "wall", here's my final SQL:
ALTER TABLE TABLENAME
ADD COLUMN VISIBLE YESNO -1;
Upvotes: 2
Views: 3450
Reputation: 91366
You need to execute against a connection to use Default, eg:
s = "ALTER TABLE TABLE1 ADD COLUMN VISIBLE YESNO DEFAULT true"
CurrentProject.Connection.Execute s
-1 is fine, too. If you want to display a checkbox, you will need VBA.
Upvotes: 2