Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete table Question 2

Status
Not open for further replies.

jcarneir

Programmer
May 17, 2001
26
VE
Hi,

I want to know if I can delete a table in an external database

I can delete a table in the current database by:
docmd.DeleteObject actable,"MyTable"

Thanks
 
Paste the following code into a new Code Module:
Code:
Public Sub TableDelete(dbsName As String, tblName As String)
    Dim dbs As Database
    Set dbs = OpenDatabase(dbsName)
    dbs.TableDefs.DELETE tblName
    dbs.Close
End Sub

For example, calling this sub with:
[tt]Call TableDelete("C:\MyDbs.mdb", "MyTable")[/tt]

...will delete the table MyTable from the database file C:\MyDbs.mdb.
 
You may also consider the DROP TABLE sql instruction.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top