Link Table in access

Source: Internet
Author: User

For a site that uses ASP and mdb, a MDB uses a chain table to link to another table in the current directory. This allows data sharing.
Bytes.
I think the solutions are as follows:
One is to create a directory structure identical to the online space on the local machine. But this is very troublesome, especially if you need to change the website frequently.
One way is to make the chain table use a relative path, that is, the MDB file linked to the current directory? (By The Way, access is very retarded. The Link Table records absolute paths ).
Also, how can I modify the link of a linked table through programming (ASP or local VBA? (Again, access is still mentally retarded. I can only use manual updates to update the chain table. Make sure to find the MDB in that path! The local path is different from the online path)

Who can tell me how to implement the above two methods?

---------------------------------------------------------------

Below is my own ADOXCodeTo prove that the access I mentioned has this function (which is not nice to say: this is about access P? This is the problem solved by the ADO model. In addition, you also mentioned the mistake, which is more suitable for ASP.) You should be familiar with access programming. If you cannot understand it, I can only say sorry.

Public Function newlinkedexternaltablemdb ()
Dim strtargetdb () as string
Dim strproviderstring () as string
Dim strsourcetbl () as string
Dim strlinktblname () as string
Dim catdb as ADOX. Catalog
Dim tbllink as ADOX. Table
Dim tmplink as ADOX. Table
Dim I as integer
Dim J as integer
Set catdb = new ADOX. Catalog
Catdb. activeconnection = currentproject. Connection
I = catdb. Tables. Count
Redim strtargetdb (I)
Redim strproviderstring (I)
Redim strsourcetbl (I)
Redim strlinktblname (I)
I = 1
For each tmplink in catdb. Tables
If tmplink. properties ("jet oledb: Create link") then
If trim (tmplink. properties ("jet oledb: Remote table name") <> "" then
Strlinktblname (I) = tmplink. Name
Strtargetdb (I) = tmplink. properties ("jet oledb: link datasource ")
Strproviderstring (I) = tmplink. properties ("jet oledb: link provider string ")
Strsourcetbl (I) = tmplink. properties ("jet oledb: Remote table name ")
Do While instr (1, strtargetdb (I), "/") <> 0
Strtargetdb (I) = mid (strtargetdb (I), instr (1, strtargetdb (I), "/") + 1, Len (strtargetdb (I )))
Loop
Strtargetdb (I) = currentproject. Path & "/" & strtargetdb (I)
I = I + 1
End if
End if

Next
J = I-1
For I = 1 to J
Catdb. Tables. Delete strlinktblname (I)
Set tbllink = new ADOX. Table
With tbllink
. Name = strlinktblname (I)
Set. parentcatalog = catdb
. Properties ("jet oledb: Create link") = true
. Properties ("jet oledb: link datasource") = strtargetdb (I)
. Properties ("jet oledb: link provider string") = strproviderstring (I)
. Properties ("jet oledb: Remote table name") = strsourcetbl (I)
End
Catdb. Tables. append tbllink
Set tbllink = nothing
Next
Set catdb = nothing
End Function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.