G
Guest
Hello,
I have used this fragment of code to manipulate the creations of my
recordsets for 5 years without a problem!
However I was always using the following library reference:
Microsoft Acytive-x objects 2.5 library
Today, I have tried the newer version which is:
Microsoft Acytive-x objects 2.8 libtrary
And now, one of the return commands generate an error!
The error is "Runtime error 13" Type mismatch.
It generates this error at the following line:
Set SetRsts = rst1
Here is a more detailed sample of my code. I just don't understand why in
2.5, it does not generate an error, and in 2.8 it does.
Here is the fragment of code, .... it simply is supposed to return a
variable of Recordset type.
-----------------------------------------------------------------------
Private Sub Function1()
Dim rst1Util As ADODB.Recordset
Set rst1Util = OBJ_SQL_Rsts.SetRsts()
'OTHER CODE.......
'.................
End Sub
-----------------------------------------------------------------------------------
Public Function SetRsts() As Recordset
Dim cnn1 As ADODB.Connection
Dim rst1 As ADODB.Recordset
Set rst1 = New ADODB.Recordset
Set cnn1 = CurrentProject.Connection
rst1.ActiveConnection = cnn1
rst1.LockType = adLockOptimistic
rst1.CursorLocation = adUseServer
rst1.CursorType = adOpenKeyset
Set SetRsts = rst1
End Su
I have used this fragment of code to manipulate the creations of my
recordsets for 5 years without a problem!
However I was always using the following library reference:
Microsoft Acytive-x objects 2.5 library
Today, I have tried the newer version which is:
Microsoft Acytive-x objects 2.8 libtrary
And now, one of the return commands generate an error!
The error is "Runtime error 13" Type mismatch.
It generates this error at the following line:
Set SetRsts = rst1
Here is a more detailed sample of my code. I just don't understand why in
2.5, it does not generate an error, and in 2.8 it does.
Here is the fragment of code, .... it simply is supposed to return a
variable of Recordset type.
-----------------------------------------------------------------------
Private Sub Function1()
Dim rst1Util As ADODB.Recordset
Set rst1Util = OBJ_SQL_Rsts.SetRsts()
'OTHER CODE.......
'.................
End Sub
-----------------------------------------------------------------------------------
Public Function SetRsts() As Recordset
Dim cnn1 As ADODB.Connection
Dim rst1 As ADODB.Recordset
Set rst1 = New ADODB.Recordset
Set cnn1 = CurrentProject.Connection
rst1.ActiveConnection = cnn1
rst1.LockType = adLockOptimistic
rst1.CursorLocation = adUseServer
rst1.CursorType = adOpenKeyset
Set SetRsts = rst1
End Su