Delete a backend table

U

UnnurU

I must write VBA code to delete a Linked table; both the
frontend and the backend.
I use DoCmd.RunSql "Drop Table theTable" to delete the
frontend table.
Can someone advice me how to delete the backend table in
another database, by using VBA?

Thanks UU
 
M

Marshall Barton

UnnurU said:
I must write VBA code to delete a Linked table; both the
frontend and the backend.
I use DoCmd.RunSql "Drop Table theTable" to delete the
frontend table.
Can someone advice me how to delete the backend table in
another database, by using VBA?

Dim dbFE As Database
Dim dbBE As Database
Dim strBEpath As String
Dim strBEtable As String

Set dbFE = Current Db()
With dbFE.TableDefs("frontendtablename")
strBEpath = Mid(.Connect, 11)
strBEtable = .SourceTable
End With

Set dbBE = OpenDatabase(strBEpath)
dbBE.TableDefs.Delete strBEtable
dbBE.Close: Set dbBE = Nothing

dbFE.TableDefs.Delete "frontendtablename"
Set dbFE = Nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top