bontyboy
Feb 27th, 2000, 06:30 PM
Can you use this code to connect to a Access 2000 database. I was told that you have to use DAO 3.6. I am trying to connect to Access 2000 using ADO.
'references: 'ActiveX Data Objects 2.1 'ADO 2.1 for DDL and security
Dim tbl As ADOX.Table Dim cn As ADODB.Connection
Dim ax As ADOX.Catalog
Set cn = New ADODB.Connection 'connect
cn.Open "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=Nwind.mdb"
Set ax = New ADOX.Catalog ax.ActiveConnection = cn
'loop thru tables
For Each tbl In ax.Tables
Debug.Print tbl.Name & " " & tbl.Type
Next tbl
'close connection
cn.Close
Set cn = Nothing
'references: 'ActiveX Data Objects 2.1 'ADO 2.1 for DDL and security
Dim tbl As ADOX.Table Dim cn As ADODB.Connection
Dim ax As ADOX.Catalog
Set cn = New ADODB.Connection 'connect
cn.Open "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=Nwind.mdb"
Set ax = New ADOX.Catalog ax.ActiveConnection = cn
'loop thru tables
For Each tbl In ax.Tables
Debug.Print tbl.Name & " " & tbl.Type
Next tbl
'close connection
cn.Close
Set cn = Nothing