By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,758 Members | 1,247 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,758 IT Pros & Developers. It's quick & easy.

Using ADOX to update a Property does not work.

P: n/a
Using ADOX to update a Property does not work.

I want to change the Access database for a linked table. My abridged code is:

Dim oCAT As ADOX.Catalog
oCAT = New ADOX.Catalog
oCAT.ActiveConnection = goConnection
Dim t As ADOX.Table
Dim p As ADOX.Property

For Each t In oCAT.Tables
If t.Type = "LINK" Then
t.Properties("Jet OLEDB:Link Datasource") = "C:\MyAccess.mdb"
End If
Next t

When I write the code in Access 2003, it works fine. When I write this code
in VB.NET, I get an error message for this line: 't.Properties(.....) =
"....."'
that says "Property Item is read-only". The line does not compile.

How can I change this property for a linked table from VB.NET??
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Sun, 6 Mar 2005 03:39:02 -0800, "genojoe" <ge*****@discussions.microsoft.com> wrote:

Using ADOX to update a Property does not work.

I want to change the Access database for a linked table. My abridged code is:

Dim oCAT As ADOX.Catalog
oCAT = New ADOX.Catalog
oCAT.ActiveConnection = goConnection
Dim t As ADOX.Table
Dim p As ADOX.Property

For Each t In oCAT.Tables
If t.Type = "LINK" Then
t.Properties("Jet OLEDB:Link Datasource") = "C:\MyAccess.mdb"
End If
Next t

When I write the code in Access 2003, it works fine. When I write this code
in VB.NET, I get an error message for this line: 't.Properties(.....) =
"....."'
that says "Property Item is read-only". The line does not compile.

How can I change this property for a linked table from VB.NET??

You need to specify the Value property:

t.Properties("Jet OLEDB:Link Datasource").Value = "C:\MyAccess.mdb"
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 21 '05 #2

P: n/a
It does work. My line of code needs to be:

t.Properties("Jet OLEDB:Link Datasource").Value = "C:\MyAccess.mdb"

With this change it worked fine.
"Paul Clement" wrote:
On Sun, 6 Mar 2005 03:39:02 -0800, "genojoe" <ge*****@discussions.microsoft.com> wrote:

¤ Using ADOX to update a Property does not work.
¤
¤ I want to change the Access database for a linked table. My abridged code is:
¤
¤ Dim oCAT As ADOX.Catalog
¤ oCAT = New ADOX.Catalog
¤ oCAT.ActiveConnection = goConnection
¤ Dim t As ADOX.Table
¤ Dim p As ADOX.Property
¤
¤ For Each t In oCAT.Tables
¤ If t.Type = "LINK" Then
¤ t.Properties("Jet OLEDB:Link Datasource") = "C:\MyAccess.mdb"
¤ End If
¤ Next t
¤
¤ When I write the code in Access 2003, it works fine. When I write this code
¤ in VB.NET, I get an error message for this line: 't.Properties(.....) =
¤ "....."'
¤ that says "Property Item is read-only". The line does not compile.
¤
¤ How can I change this property for a linked table from VB.NET??

You need to specify the Value property:

t.Properties("Jet OLEDB:Link Datasource").Value = "C:\MyAccess.mdb"
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.