Delete a table using ADO

  • Thread starter Thread starter jimmyturnip
  • Start date Start date
J

jimmyturnip

Guest
Hello,

I'm trying to do something fairly simple - delete a table in my database using VBA. I know how to do it using DAO, but I'm trying to wean myself of it. If I was using DAO, I would write...

db.tabledefs("MyTable").delete

Does anyone know how I can achieve the same using ADO?

Many thanks,

James Turner

P.S. This forum has save my bacon loads of times. Cheers!
 
I have not tried it, but the SQL is DROP TABLE tablename, and you have to have access to do it (Admin). I would think you could execute this SQL within ADO.
 
Make a reference to "Microsoft ADO Ext. 2.5 for DDL and Security"

Dim cat As New ADOX.Catalog
cat.ActiveConnection = CurrentProject.Connection
cat.Tables.Delete "TableName"
 

Users who are viewing this thread

Back
Top Bottom