Delete field from table in VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Greetings!

How do I use VBA to delete an entire field from a table? I initially need
this field, but later I would like to get rid of the field entirely. I do
not want users going into the table design to delete this field, and would
rather use VBA to delete the field. Any suggestions?

Jessica
 
This should do it:
strSql = "ALTER TABLE [MyTable] DROP COLUMN [DeleteMe];"
DBEngine(0)(0).Execute strSql, dbFailOnError
 
That worked. Thank you!

Allen Browne said:
This should do it:
strSql = "ALTER TABLE [MyTable] DROP COLUMN [DeleteMe];"
DBEngine(0)(0).Execute strSql, dbFailOnError

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Jessica said:
Greetings!

How do I use VBA to delete an entire field from a table? I initially need
this field, but later I would like to get rid of the field entirely. I do
not want users going into the table design to delete this field, and would
rather use VBA to delete the field. Any suggestions?

Jessica
 
Back
Top