ADO questions

L

Luke

I use the following DAO code to connect to external table
via ODBC on db open.

Sub LinkTable()
Dim dbs As DAO.Database
Dim tbl As DAO.TableDef
Dim rst As DAO.Recordset

'Set db to current db
Set dbs = CurrentDb()

'Create linked table
Set tbl = dbs.CreateTableDef("tbl_Link")

'Get OBDC connection string
With tbl
.Connect
= "ODBC;DSN=<>;DBQ=<>;ASY=OFF;UID=<>;PWD=<>"
.SourceTableName = "LINKED_TABLE"
End With

'Append table
dbs.TableDefs.Append tbl

'Open table
Set rst = dbs.OpenRecordset("tbl_Link ")

End Sub

Does anybody know where to find corresponding ADO code or
can convert it? I use ADO throughout the db, but have
not been able to find any reference how to create ADO
link ( I have spent 2 days looking, but to no avail).

Thanks for your help.
 

Ask a Question

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.

Ask a Question

Top