471,601 Members | 1,185 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,601 software developers and data experts.

Using ADOX to update a Property does not work.

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
2 5357
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
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.

Similar topics

2 posts views Thread by Developer98115 | last post: by
6 posts views Thread by Claudia Fong | last post: by
4 posts views Thread by Frank Rizzo | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.