I figured it out, this is how it works for me. I call this function wit as parameter the linked tablename:
Public Sub EditExternalTable(tablename As String)
Dim BeName As String
Dim appAccess As Object
Dim db As Database
Dim RemoteTabName As String
Set appAccess = CreateObject("Access.Application")
BeName = BackendNaam(tablename)
RemoteTabName = Nz(DLookup("foreignname", "msysobjects", "name='" & tablename & "'"))
If BeName <> "None" Then
appAccess.OpenCurrentDatabase (BeName)
appAccess.DoCmd.OpenTable RemoteTabName, acDesign
appAccess.Visible = True
MsgBox " Close external database?"
End If
Set appAccess = Nothing
End Sub
Function BackendNaam(tabel As String) As String
Dim conm As String
On Error GoTo no_Table
conm = CurrentDb.TableDefs(tabel).Connect
If Len(conm) > 10 Then
BackendNaam = Right(conm, Len(conm) - 10)
Else
BackendNaam = "None"
End If
Exit Function
no_Table:
BackendNaam = "None"
End Function
Posted by: onno.knol@pbl.nl
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (8) |
Tidak ada komentar:
Posting Komentar