Solved

How Do I Return Multiple Recordsets from SQL Stored Procedure in Access 2010

Posted on 2013-12-04
3
888 Views
Last Modified: 2013-12-04
I’ve created a pass-through query in Access which executes a stored procedure that searches for a string across all tables in my SQL database. The stored procedure on the SQL server runs as expected, returning multiple Recordsets that contain the value of my search string. However, when I double-click on the pass-through query in Access, in Datasheet View I see the results of only one Recordset.  Since it appears that Access is not designed to handle multiple result sets, then how do I use VBA in Access to accomplish this?
0
Comment
Question by:cartb4horse
3 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 39696322
I don't think you'd see those results in the query window. You'd have to manage this through code, something like:

Dim rst As New ADODB.Recordset
rst.Connection = YourADOConnection
rst.OPen "EXEC YourSPName"

Dim rst1 As Variant
Dim rst2 As Variant

rst1 = rst.NextRecordset
rst2 = rst.NextRecordset
'/ and so on

This is aircode, from some stuff I did a loooong time ago ... hope it helps.
0
 
LVL 1

Author Comment

by:cartb4horse
ID: 39696802
I think this will work for me.  I also found this MS article that has a similar approach:  http://support.microsoft.com/kb/182290.
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 39696806
I think that was for an ODBCdirect workspace - which is no longer supported in Access but still mentioned in the on-line help (look it up).

Thus, I believe, this is not possible with A2010+.

/gustav
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

777 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