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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting a Linked Table 1

Status
Not open for further replies.

nickperez22

Technical User
Jun 13, 2001
62
US
How can I delete one linked table in Code? I tried setting the the current db to the linked db and then using the delete object method, however all it does is delete the reference to the front end. It seems as though I'm not pointing properly to the backend db.

I'm using
Dim db as database
'This is my backend data base
Set db = OpenDatabase("c:\program files\turns\poslite.mdb")
'This is the table I want to delete
DoCmd.DeleteObject acTable, "TITLESupd
 
Your Docmd statement knows nothing about the other database.

Make sure you have a backup before testing.

Sub deletetabel()

Dim db As Database
Set db = DBEngine.OpenDatabase("db1.mdb")' path to database

db.TableDefs.Delete "aaaa" ' name of table

db.Close
Set db = Nothing

End Sub
 
Thanks so much for your help, what would be the syntax to rename a table in linked access database?
 
Db.TableDefs("MyTable").Name = "newname"

You have to bear in mind that you cannot rename to the name of an existing table and once you have renamed the table then the link will be lost from the frontend.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top