mwacardsfan
Jan 10 2006, 02:43 PM
Anyone know how to use code to add columns to an existing table?
freakazeud
Jan 10 2006, 02:51 PM
Hi,
check out the alter command:
Currentdb.Execute "Alter Table TableName Add Column FieldName Text"
You can find more examples searching on UA.
HTH
Good luck
mwacardsfan
Jan 10 2006, 02:55 PM
great. Thanks.
One other quick question. how do you define the new column's format to be anything other than text?
Such as integer, double, percent?
Thanks again.
freakazeud
Jan 10 2006, 03:00 PM
As mentioned search UA.
Instead of text define it as whatever you want. The syntax is:
CurrentDB.Execute "ALTER TABLE tableName ADD COLUMN columnName DataType"
datatype:
DATETIME
Text
BoolField YESNO
Integer
Single
Double
...
HTH
Good luck
mwacardsfan
Jan 10 2006, 03:04 PM
thanks1
freakazeud
Jan 10 2006, 03:05 PM
You're welcome.
Glad I could assist!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.