UnnurU wrote:
>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
--
Marsh
MVP [MS Access]
|