Richard Comito
asked on
Creating a Recordset object in a function.
Hi,
I am tring to create a recordset object to be used on other pages. Everythng in the code works until i get to:
rsEmailList.CursorLocation = ADODB.CursorLocationEnum.a dUseClient
Then I get and error that says "Object reference not set to an instance of an object". I am not sure how to set the object when I am creating this type of function.
-------------------------- ---------- ---------- ---------- ---------- ---------- -------
Public Function rsEmailList() As ADODB.Recordset
objConn.Open()
Dim cmdEmailList As New ADODB.Command
cmdEmailList.CommandText = "selLAStageTixAddress"
cmdEmailList.CommandType = ADODB.CommandTypeEnum.adCm dStoredPro c
cmdEmailList.ActiveConnect ion = objConn
rsEmailList.CursorLocation = ADODB.CursorLocationEnum.a dUseClient
rsEmailList.LockType = ADODB.LockTypeEnum.adLockR eadOnly
rsEmailList = cmdEmailList.Execute
End Function
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- -
Thank you.
I am tring to create a recordset object to be used on other pages. Everythng in the code works until i get to:
rsEmailList.CursorLocation
Then I get and error that says "Object reference not set to an instance of an object". I am not sure how to set the object when I am creating this type of function.
--------------------------
Public Function rsEmailList() As ADODB.Recordset
objConn.Open()
Dim cmdEmailList As New ADODB.Command
cmdEmailList.CommandText = "selLAStageTixAddress"
cmdEmailList.CommandType = ADODB.CommandTypeEnum.adCm
cmdEmailList.ActiveConnect
rsEmailList.CursorLocation
rsEmailList.LockType = ADODB.LockTypeEnum.adLockR
rsEmailList = cmdEmailList.Execute
End Function
--------------------------
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.