Delete a Column in Table

jhansiblu

New member
Local time
Today, 10:34
Joined
Dec 5, 2007
Messages
6
Is there any way to delete a Table column programtically? I have a table with a column that I would like to be deleted as part of a series of task executed by command button form a form. Every time the table is created the column is used to process data, but I would like to remove it after it is used. Is there a way to do that?
 
Yes, with ADO. Use ADO to run the DDL to remove the column.

Since I don't do this and never will, you'll need to look up the syntax or get somebody else's feedback.
 
I like to create temporary tables when I have an issue like that. The are easy to join for queries and reports, and you can remove the whole table when you are done.

Another thought: Why delete and re-add a whole column. That con only result in the database growing in size. Why not add the column to the end of the record and ignore it, or erase the value of the column by writing over it with NULL?
 
Last edited:
DDL statements don't fall only under the domain of being executed by ADO.
DAO is capable of running many (the OLEDB provider for Jet exposes only a scant few more methods to ADO).

CurrentDb.Execute "ALTER TABLE TableName DROP COLUMN FieldName"

As has since been mentioned though - there is nothing wrong with a column that isn't always used. Removing it during times of non-use will not make your application any more efficient.
Is this table being created by some import process?
 

Users who are viewing this thread

Back
Top Bottom