Recordsets in Access 2003

Geoff Convery

Registered User.
Local time
Yesterday, 19:50
Joined
Jul 21, 2006
Messages
33
I've been using recordsets in Access 97 and Access 2000 and now I have been trying to use them in Access 2003. If I use this code (which appears to me to be correct according to the online help in Access) then Access complains at runtime that ADODB.recordset is an undefined user-defined type.

Dim rst As ADODB.Recordset
Dim strCriteria As String

strCriteria = "idTransactionID = " & Me!numTransactionID

Set rst.Connection = CurrentProject.Connection
rst.CursorType = adopenDynamic
rst.locktype = adLockOptimistic
rst.Open "tblUnknownTransaction"

If I drop the "ADODB." bit then Access complains at runtime about the CursorType, locktype and Open properties

Have I missed something? Is there something wrong with my installation of Access 2003? or have Microsoft developed an aversion to the use of recordsets at 2003?

Hope someone can help
Thanks in anticipation
 
Yes, you did miss something. In Access 2003, the default reference is set to DAO and not ADO. You must add the ADO reference if you want to use it.
 
Thanks Bob. The problem was that I was trying to work with the recordset from the OnClose action where I now realise it's invalid.
I've put the operation in the OnClick event of a button on the form and it's fine now!!
Do I feel like a dope????
 
boblarson said:
Yes, you did miss something. In Access 2003, the default reference is set to DAO and not ADO. You must add the ADO reference if you want to use it.

Not true, 2003 utilizes both
 

Users who are viewing this thread

Back
Top Bottom