Microsoft Access Database Development With VBA

ADOX Topics: Deleting a Table



To delete a table in ADOX, call the Delete() method of the Tables collection property of the Catalog class. Pass the name (or the index, in the Tables collection) of the table. Here is an example:

Private Sub cmdDeleteTable_Click()
    Dim catStudents As ADOX.Catalog
    Set catStudents = New ADOX.Catalog
    catStudents.ActiveConnection = CurrentProject.Connection
    catStudents.Tables.Delete "Students"
    MsgBox "The table named Students has been deleted."
    Set catStudents = Nothing
End Sub

Home Copyright © 2013-2015, FunctionX, Inc. Home