Displaying Data

Hello,

I had this question after watching Executing a SQL Server Stored Procedure from Within Access.

The code works great and I can view the data in the immediate window. How can I display this data in an access table or query?

Thank you.
SantiASCAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim HornMicrosoft SQL Server Data DudeCommented:
<knee jerk reaction>
Create the Access local table, then create an INSERT query that inserts all rows from the pass-through query into that table.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SantiASCAuthor Commented:
JIm,

I am sorry I am new to this. I don't have a pass-through query created, how  do I go about creating a pass-through query that grabs the information from the record set created in vba?

Thank you .
Jim HornMicrosoft SQL Server Data DudeCommented:
Explain in more non-technical terms what you're trying to pull off here.
SantiASCAuthor Commented:
I am trying to link multiple SQL stored procedures from an SQL server into an access DB. I am doing this for multiple stored procedures so that I can create relationships across many tables. The tables are very large and it really slow down the system when using other tools like excel. Following the video of "Executing a SQL Server Stored Procedure from Within Access." I am able to view the data in the vba immediate window. This is my code.

Sub ExecuteStoreProc()

    Dim cmd As ADODB.Command
    Dim rst As ADODB.Recordset

   
    Set cmd = New ADODB.Command
   
    With cmd
        .activeconnection = connectstring
        .commandtext = "cds.dbo.usp_xls_SAMIILotCostAnalysis"
        .commandtype = adcmdstoredproc
        Set rst = .Execute
       
    End With

    Do Until rst.EOF
       
        Debug.Print rst("Lot#") '& ", " & rst("Brand") & ", " & rst("Type") & ", " & rst("Qualifier")
       
        rst.MoveNext
    Loop
   
    CurrentDb.QueryDefs.Delete "qryTemp"
    Set rst = Nothing
    Set cmd = Nothing


End Sub

Now my problem is that I don't know how to transpose this information into a query or table and I am not sure how to create a passthrough query.

Do you have any recommendations?

Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.