Solved

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

Posted on 2013-12-04
3
908 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

840 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