: I have the following problem. In my VB-application I use an Access-Database
: with a link set to a table from another Access-Database. It works fine, but
: when I change the location of the linked database, I get an error, because
: the full path of the linked database is included. Is there any possibility
: to change this path from VB without using Access?
In my opinion this is a major problem with Access, but it can be worked
around through some simple VB code. The following code sets up a link
between Access tables, i also firsts deletes the link before recreating it.
---
Sub LinkTables (destDB As String)
Dim db As Database
Dim td As New Tabledef
On Error GoTo LinkError
' Open up the database variable
Set db = OpenDatabase(destDB)
' Link table into the specified database
td.Name = "TableNameHere"
db.TableDefs.Delete td
td.SourceTableName = "TableNameHere"
td.Connect = ";DATABASE=" + DBPath + ";"
db.TableDefs.Append td
'Close the database
db.Close
Exit Sub
PartNumberLinkError:
Select Case Err
Case 3265 ' Name not found in this collection
Resume Next
Case Else
MsgBox Str$(Err) + " - " + Error(Err)
Exit Sub
End Select
End Sub
--- Clip Here
Just replace TableNameHere with the name of the table you are linking
between databases and the DBPath with the full path to the MDB
Hope this helps get you started
--Bill Froelich