I can reproduce that. The code will run without error if I print just the
Name of the property, but fails on any attempt to print the Value.
I can understand why you would prefer to use one technology for both data
sources, but I suspect this may not be possible. I suspect you may need to
use one technology (SQLDMO, perhaps?) to work with the SQL Server tables and
another (I recommend DAO) to work with the Jet tables.
Here's my test code, fails with error 3251 if the commented line is
uncommented. I used 'On Error Resume Next' to resume testing the next
property after an error, confirming that the error occurs with all
properties.
Public Sub ListSqlProps()
Dim cnn As ADODB.Connection
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Dim col As ADOX.Column
Dim prp As ADOX.Property
On Error GoTo ErrorHandler
Set cnn = New ADODB.Connection
cnn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=pubs;Data Source=(local)"
Set cat = New ADOX.Catalog
cat.ActiveConnection = cnn
Set tbl = cat.Tables("authors")
Set col = tbl.Columns(0)
For Each prp In col.Properties
Debug.Print prp.Name
'Debug.Print CStr(prp.Value)
Next prp
ExitProcedure:
On Error Resume Next
cnn.Close
Exit Sub
ErrorHandler:
MsgBox "Error " & Err.Number & ": " & Err.Description
Resume Next
End Sub
--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com
The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.