Changing linked table path programmatically?

Results 1 to 2 of 2

Thread: Changing linked table path programmatically?

  1. #1
    Join Date
    Dec 1969

    Default Changing linked table path programmatically?

    Anybody know how you might do this via a script?<BR><BR>I&#039;ve got an Access database with linked tables that I want to use locally and on a webserver but the linked table paths are hardcoded into the database and are absolute not relative. Thus the PWS does recognise e:... and my webserver c:... etc etc<BR><BR>I have setup my webserver&#039;s file structure locally and can use that method with Access&#039; Linked Table Manager to do it manually but is a bit of chore.<BR><BR>Many thanks<BR>Tim Grose

  2. #2
    Join Date
    Dec 1969

    Default RE: Changing linked table path programmatically?

    You will need to recreate the links after you have uploaded the db so before you upload remove all the linked tables, then look up...<BR><BR>set objConnection = server.createObject("adodb.connection")<BR>objConn application("db you want the link in")<BR> <BR>Set adoCat = server.createObject("ADOX.Catalog") <BR>set adoCat.ActiveConnection = objConnection<BR> <BR>set adoTbl = server.createObject("ADOX.Table") <BR>Set adoTbl.ParentCatalog = adoCat<BR>adoTbl.Name = "COMPANY"<BR> <BR>adoTbl.Properties("Jet OLEDB:Link Datasource") = application("root") & "location of the target db (contins the table to be linked to)"<BR>adoTbl.Properties("Jet OLEDB:Link Provider String") = "MS Access"<BR>adoTbl.Properties("Jet OLEDB:Remote Table Name") = "name of table to link to"<BR>adoTbl.Properties("Jet OLEDB:Create Link") = True<BR> <BR>&#039;Append the table to the tables collection<BR>adoCat.Tables.Append adoTbl<BR> <BR>set adoTbl = nothing<BR><BR>you now have linked one table.<BR><BR>Use this as a base for a google and you should find more information

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts