Pages

Tuesday, December 27, 2011

Delete a table using DAO

If you would like to delete the table from the database

Here is the code-

Sub delete_table_using_DAO()
DoCmd.SetWarnings (False)
On Error Resume Next
'close the table if open
DoCmd.Close acTable, "Table1", acSaveYes
On Error Resume Next
' delete table Table1 if exists
CurrentDb.TableDefs.Delete "Table1"
RefreshDatabaseWindow
DoCmd.SetWarnings (True)
End Sub

Download Database

No comments:

Post a Comment