relink access tables in vb.net code

  • Thread starter Thread starter Cyrus
  • Start date Start date
¤ is it possible to do so?
¤

Are you referring to linking tables to Access database? If so, yes you can use ADOX. Perhaps you can
be more specific as to exactly what you want to do?


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
what is ADOX?
I want to dynamically create and link to a empty Access db by program code
when my current Access db get full as it has size limitation?
thz

 
¤ what is ADOX?
¤ I want to dynamically create and link to a empty Access db by program code
¤ when my current Access db get full as it has size limitation?
¤ thz
¤
¤ "Paul Clement" <[email protected]> ???
¤ ???...
¤ > On Fri, 2 Jan 2004 10:23:18 +0800, "Cyrus" <[email protected]>
¤ wrote:
¤ >
¤ > ¤ is it possible to do so?
¤ > ¤
¤ >
¤ > Are you referring to linking tables to Access database? If so, yes you can
¤ use ADOX. Perhaps you can
¤ > be more specific as to exactly what you want to do?

ADOX is the counterpart to ADO for manipulating database structures. You need to add the reference
to your project (Add Reference...COM tab...look for Microsoft ADO Ext 2.x for DDL and Security). You
also need to add the reference for ADO (Microsoft ActiveX Data Objects 2.x) Here is some sample
code that creates a linked table to another Access database:

Sub CreateAttachedAccessTableWithADOX()

Dim ADOXTable As New ADOX.Table
Dim ADOXCatalog As New ADOX.Catalog
Dim ADOConnection As New ADODB.Connection

Try

ADOConnection.Open("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=e:\My Documents\db1.mdb;" & _
"Jet OLEDB:Engine Type=4;")

ADOXCatalog.ActiveConnection = ADOConnection

ADOXTable.Name = "Table11Linked"
ADOXTable.ParentCatalog = ADOXCatalog
ADOXTable.Properties("Jet OLEDB:Link Provider String").Value = "MS Access;DATABASE=E:\My
Documents\AccessDB.mdb"
ADOXTable.Properties("Jet OLEDB:Remote Table Name").Value = "Table11"
ADOXTable.Properties("Jet OLEDB:Create Link").Value = True
ADOXCatalog.Tables.Append(ADOXTable)
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
ADOConnection.Close()
End Try

End Sub


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Back
Top