set recordset returned by command.execute to a datagrid

Posted on 2004-10-21
Last Modified: 2010-08-05
I would like to know, if a recordset is derived from command.execute, how to get it into a datagrid?

my current code is like this:

dim rs as recordset
dim cmd as new command

set cmd.activeconnection = cn ' a valid connection
cmd.commandtext = "......" ' a valid sql statement

set rs = cmd.execute(,,adAsyncExecute)

'here is what I tend to do:
set datagrid1.datasource = rs
'it fails on 'rowset is not bookmarkable...'

I know if I use, it will be ok, like this:
set rs = new recordset "....",cn, adOpenStatic, adLockReadOnly
set datagrid.datasource = rs
but I don't want to do this because I need the 'adAsyncExecute' - to execute  the command asynchronously.

Thanks for your help

Question by:ChenChen
    LVL 4

    Accepted Solution

    You should be able to use adAsyncExecute after the locktype in command. "....",cn, adOpenStatic, adLockReadOnly, adAsyncExecute
    LVL 4

    Expert Comment

    LVL 4

    Expert Comment

    The equivalent in command.execute is adAsynchFetch

    See this link for specs:

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
    Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    931 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now