Delete a table from another database

yippie_ky_yay

Registered User.
Local time
Today, 02:13
Joined
Jul 30, 2002
Messages
338
Hello forum,

I need to be able to delete a table. It's the result of a make table query which I use for reports - but could never be uploaded on our website (presently, I open the database, delete the table and then upload it).

I was thinking that I could link the table in question from another database, and delete all the records leaving me with an empty table.

Is there not a better way though? Could I not drop the whole table without having to open the database it's housed in?

Any help/advice would be greatly appreciated!

-Sean
 
Try this code on other db.

Code:
Private Sub DeleteTable()
Dim dbs As Database
Set dbs = OpenDatabase("c:\yourtargetdb.mdb")
On Error Resume Next
dbs.TableDefs.Delete "Table1 "
dbs.Close
Set dbs = Nothing
End Sub
 
Thank you Tim - worked beautifully! Much appreciated!

-Sean
 

Users who are viewing this thread

Back
Top Bottom