Search notes:

Access: DoCmd.DeleteObject

Dropping a table

doCmd.deleteObject acTable, "theTable"
If the table to be dropped is opened, it cannot be closed and the run-time error 2008 is thrown (You can't delete database object '…' while it's open.).
An opened table (or object, for that matter), is closed with doCmd.close:
doCmd.close        acTable, "theTable", acSaveYes ' Or acSaveNo or acSavePrompt
doCmd.deleteObject acTable, "theTable"

See also

doCmd

Index