Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Link tables using vb

Status
Not open for further replies.

kaiana

Programmer
Sep 6, 2002
85
AU
I have an access split database that I need to install on many different networks. The backend is always located \\server\sharedfile\filename.mdb. when i install the front end on a workstation I get an error msg that the link can not be found. I have created a splash form in which i have run many sample codes to recreate the link. but the error remains the same. Can anybody help?

Kind regards
Jason Spence
 
I use SQL Server for my databases but I'm told this is the code for linking to Access tables. *you need the ADOX references installed first
Code:
Dim cnn As ADODB.Connection
    Dim cat As ADOX.Catalog
    Dim tbl As ADOX.Table

    Set cnn = CurrentProject.Connection
    Set cat = New ADOX.Catalog
    cat.ActiveConnection = cnn
    For Each tbl In cat.Tables
'linked to another Microsoft Access Database  *
 If (tbl.Type = "LINK") Then
 tbl.Properties("Jet OLEDB:Link Datasource") = "NameOfAccessDataBase"
ElseIf (tbl.Type = "PASS-THROUGH") Then
tbl.Properties("Jet OLEDB:Link Provider String") = "ODBC;DSN=YourDSNname;DATABASE=YourDatabaseName;UID=YourUserName;pwd=YourPassword;"
End If
Next
Hope this works for you
Ryan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top