Link to home
Start Free TrialLog in
Avatar of Richard Comito
Richard ComitoFlag for United States of America

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.adUseClient

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.adCmdStoredProc
        cmdEmailList.ActiveConnection = objConn
        rsEmailList.CursorLocation = ADODB.CursorLocationEnum.adUseClient
        rsEmailList.LockType = ADODB.LockTypeEnum.adLockReadOnly
        rsEmailList = cmdEmailList.Execute
    End Function

---------------------------------------------------------------------------------------


Thank you.
ASKER CERTIFIED SOLUTION
Avatar of Mikal613
Mikal613
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial