ADO from DAO conversion errors, in regards to recordsets

wavp

Registered User.
Local time
Today, 07:50
Joined
Apr 18, 2003
Messages
19
I am trying to convert my code to ADO from DAO, but I am getting errors...below is bit of my code have converted to ADO, but I am getting this error:

Run-time error '91':

Object variable or With block variable not set

Any idea what is wrong with the code below??

Cheers
Will

Code:
Dim cnn As ADODB.Connection
Dim rsDBStatus As ADODB.Recordset
Dim strDBStatus As String
    
Set cnn = CurrentProject.Connection

'Get the current db status (locked or unlocked)
rsDBStatus.Open "SELECT * FROM tblCfg WHERE Cfg_Name=""Locked""", cnn

strDBStatus = rsDBStatus("Cfg_Value")

MsgBox strDBStatus

rsDBStatus.Close
cnn.Close
 
After the line that says:
Set cnn = CurrentProject.Connection
you need a line that says:
Set rsDBStatus = New ADODB.Recordset
 
Cheers mate
 

Users who are viewing this thread

Back
Top Bottom