What is the difference between DoCmd.DeleteObject acTable Vs. DROP TABLE
ms-access, vba
Solution
DoCmd.DeleteObject acTable, "aaaTest"
...and...
Dim cdb As DAO.Database
Set cdb = CurrentDb
cdb.Execute "DROP TABLE [aaaTest]", dbFailOnError
...and...
Dim cdb As DAO.Database
Set cdb = CurrentDb
cdb.TableDefs.Delete "aaaTest"
...are all just different ways of accomplishing the same thing. They delete the local `TableDef` object with that name (either an actual local table, or a table link).
Problem
Details: I have an MS-Access Database procedure where I create tables locally in the database. However, I want to ensure that the tables I create are tested for and if the test fails I need to delete/drop the other tables that have been created. Basically a rollback procedure I guess. Question: I came across the two methods to delete tables but cannot figure out if one has more pro than cons etc... Can someone tell me what the difference is? Many Thanks!