Re-linking Access tables with ADOX

Re-linking Access tables with ADOX

Post by Milwauke » Thu, 13 Jan 2000 04:00:00



I have an application that I need to distribute with two databases- one
database that our company may change from time to time and resdistribute
to our customers, and a second table that contains the customer's
personal data AND links to the tables in the first database.  However,
since I do not know what directory the customer will be installing the
software in, I need to know how to update these links without destroying
the relationships between the tables, etc.

I have tried to use the code samples from MSDN, but when I run the code,
I get a very generic error like "Errors Encountered".  I just had to
reboot and lost the code, so I can't reproduce it quickly.  I have
written code to delete the existing links and recreate them using the
database in the current directory, but this blows away the
relationships.

The source and target databases do not have passwords at the database
level, but I do have a custom SECURED.MDW file for the databases.  As I
said above, I can write code to delete and recreate the links, so I
think I am handling the password issues correctly.

Are these errors caused by the relationships that exist?  Is it too
complex for ADOX to handle, or am I missing a step?  Any advice on this
one would be appreciated.

 
 
 

1. Help ADOX for ReLinking Dbase Table in Access

I am trying to relink a dbase table that is in my access database
with the code below.  I am getting an error at the line:

tblLink.Properties("Jet OLEDB:Create Link") = True

thats says...

[Multiple-step OLE DB operation generated errors.  Check each
OLE DB status value, if available.  No work was done.]

Can anyone help me with this?

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

Private Sub RefreshLinks()

   Dim catDB As ADOX.Catalog
   Dim tblLink As ADOX.Table

   Set catDB = New ADOX.Catalog
   ' Open a Catalog on the database in which to create the link.
   catDB.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
_
               & App.Path & "\..\onestaff.mdb;Persist Security Info=False"

   For Each tblLink In catDB.Tables
      ' Check to make sure table is a linked table.
      If tblLink.Type = "LINK" Then

         If tblLink.Name = "EMPUHS" Then
            tblLink.Properties("Jet OLEDB:Link Datasource") = App.Path
            tblLink.Properties("Jet OLEDB:Create Link") = True
         End If

      End If
   Next

   Set catDB = Nothing

End Sub

2. ODBC-Driver for Paradox-DB Vers. 7 or 8

3. ADOX and Access linked tables

4. Free Delphi VB Resource, lots of Freeware, Free components, OCX!!!

5. ADOX and Access Linked Tables

6. micro brewery tour

7. Any and all alternatives for SQL Mail & email notification?

8. ADOX Indexes on Access Linked Tables...

9. Linked dbaseIV-file in ACCESS to be relinked by VB