Creating a Recordset object in a function.

Posted on 2004-11-02
Medium Priority
Last Modified: 2010-04-23

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
        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.
Question by:Richard Comito
1 Comment
LVL 48

Accepted Solution

Mikal613 earned 2000 total points
ID: 12476769
Public Function rsEmailList() As ADODB.Recordset
        dim rs as adodb.recordset

  set rs = new adodb.recordset

blah blah

  rsEmailList = rs
    End Function

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question