View Full Version : ADO not DAO


jl39775
12-12-2001, 12:09 PM
I am using the below code in a module to access a table. How can I do this using ADO.
The database is already open. I can not declare the ADO as a database.

Dim MYdb As Database
Dim MYrs As Recordset

Set MYdb = CurrentDb
Set MYrs = MYdb.OpenRecordset("select * from UploadInventory", dbOpenDynaset)

Please help,

James

cpod
12-12-2001, 12:27 PM
First, make sure the proper references are set for ADO. Then:

Dim MYdb As ADODB.Connection
Dim MYrs As New ADODB.Recordset

Set MYdb = CurrentProject.Connection
MYrs.Open "select * from UploadInventory",Mydb, adOpenDynamic, adLockOptimistic

jl39775
12-12-2001, 12:52 PM
cpod,

Thanks, this is what I need.

James