Linking Access-Databases 
Author Message
 Linking Access-Databases

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?

Peter



Sun, 05 Apr 1998 03:00:00 GMT  
 Linking Access-Databases
: 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



Fri, 10 Apr 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Linking Access Database to telephone so reconizes Number from Database

2. Link Access Database on to the Internet using MS_- Frontpage

3. Link Access Database to a mdw-File?

4. Link to Access database without MS Access..?

5. Link to particular record in Access database?

6. Linking an access database search form to the Internet

7. Dynamic Linking of Access Database

8. link shapes to an Access database

9. Word form link to Access Database

10. linking an excel spreadsheet to an access database using vb

11. Accessing Multiple Linked Database Tables on the VB Form

12. Linking access to another database.

 

 
Powered by phpBB® Forum Software