Article ID: 110959
Article Last Modified on 1/9/2003
Dim db as database
Set db=OpenDatabase("testing.mdb")
db.Execute "Delete From BadTable"
Sub Form_Load ()
Dim db As database
Dim tds As TableDefs
form1.Show ' Must Show form in Load event for Print to be visible.
form1.WindowState = 2 ' Maximize Form1 to make room for table list.
sourcedb = "c:\VB3\BIBLIO.MDB" ' Original master database.
destdb = "C:\TEST.MDB" ' Path to database with table to delete.
tabletodelete = "Authors"
FileCopy sourcedb, destdb ' Use copy of database; preserve original.
Set db = OpenDatabase(destdb)
Set tds = db.TableDefs ' Open the TableDefs collection.
' Display names of all tables in database:
For j = 0 To tds.Count - 1
Print tds(j).Name
Next
Print
' Delete a table. (This deletes the TableDef and all records):
tds.Delete tabletodelete
' or use: db.TableDefs.Delete tabletodelete
' If you want to delete all records and still preserve the TableDef
' table definition, use the following instead of the above Delete:
' db.Execute "Delete From " & tabletodelete
' Display names of all tables in database:
Print "List of tables after deleting one table:": Print
For j = 0 To tds.Count - 1
Print tds(j).Name
Next
End Sub
Additional query words: 3.00
Keywords: KB110959