Delete a table in a different database

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good day.

Looking for some code that will delete all the tables from a different
database than the one that the code is running in. In other words, open an
..mdb, click a button and delete all the tables from a different database on
the server.

Any ideas? Thank you.
 
Steve said:
Good day.

Looking for some code that will delete all the tables from a different
database than the one that the code is running in. In other words,
open an .mdb, click a button and delete all the tables from a
different database on the server.

Any ideas? Thank you.

(air code)

Sub KillTables()

Dim db As Database
Dim tbl As TableDef
Dim i As Integer

Set db = Workspaces(0).OpenDatabase("Path To Other MDB")

For i = db.TableDefs.Count - 1 To 0
Set tbl = db.TableDefs(i)
db.TableDefs.Delete tbl.Name
Next i

End Sub
 
Back
Top