Friday 16 June 2017

Drop Existing table in MS Access :

I have posted an another option to drop an existing table in MS Access. Through VBA function we can drop an existing table Drop Existing table in MS Access (VBA). Here an alternate way we can do the same operation through a small code in VBA.
Dim Tbl As TableDef      
Dim TABLEDEFS
    For Each Tbl In db.TABLEDEFS
    If Tbl.Name = "DUP" Then
    db.Execute "DROP TABLE [DUP]"
    End If
Next Tbl

2 comments:

  1. If Not IsNull(DLookup("Name", "MSysObjects", "Name='ItemAttribution_IS'")) Then
    db.Execute "drop Table ItemAttribution_IS "
    End If

    ReplyDelete
  2. If Not IsNull(DLookup("Name", "MSysObjects", "Name='Table_Name'")) Then
    db.Execute "drop Table Table_Name"
    End If

    ReplyDelete