Set oConn = CreateObject("ADODB.Connection")
On Error Resume Next
oConn.Open sConnString
If Err.Number <> 0 Then
MsgBox "Error reading file " & sFileName
Else
On Error GoTo 0
Set oCat = CreateObject("ADOX.Catalog")
Set oCat.ActiveConnection = oConn
For Each oTable In oCat.Tables
If Left(oTable.Name, 4) <> "MSys" Then _
Debug.Print oTable.Name
Next oTable
End If
oConn.Close
Set oCat = Nothing
Set oConn = Nothing
End Sub
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
Just for interest, here's a variation which uses ADO only (i.e. not
ADOX) and means you don't have to parse the table names to identify
for system tables:
Sub odwDBTables()
Dim oConn As Object
Dim oRS As Object
Dim sConnString As String
Dim sFileName As String
Set oConn = CreateObject("ADODB.Connection")
On Error Resume Next
oConn.Open sConnString
If Err.Number <> 0 Then
MsgBox "Error reading file " & sFileName
Else
On Error GoTo 0
Set oRS = oConn.OpenSchema(adSchemaTables, _
Array(Empty, Empty, Empty, "Table"))
Do While Not oRS.EOF
....maybe not purely for interest, there may be functionality benefits.
I previously used ADOX exclusively for schema info, then there was one
day when ADOX could not return the schema info I need (primary keys
and unique indices) from a lesser known DBMS (Intersystems Caché,
anyone?) I searched round for an alternative and unexpectedly found it
in the ADO object model, being OpenSchema. It's very functionally
rich: take a look at:
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.