Solved

Access (ADP) Report problem using a stored procedure

Posted on 2004-09-23
3
238 Views
Last Modified: 2011-09-20
Hello everyone,

I've got a problem.  I am trying to run a report off of a Stored Procedure in SQL Server (using an ADP project database).  I bound the report to the Stored Procedure.  However, I get an error message when I run it.  I think it has something to do with my temporary table.  Do I need to issue an OUTPUT parameter?  Please help.  I have listed the code below.

---------------------------------------------------------------------------------------------------
CREATE PROCEDURE dbo.usp_Referrals_PotentialDuplicate1
AS

Create Table #TempTable (Account varchar(30), lastname varchar(30), dischargeDate DateTime, PTName varchar(30), RCVD smalldatetime, DIS smalldatetime, MGR char(10), Hospitalname Char(50), Hospitalcode Int)

Insert INTO #TempTable
Select referrals_dts.Account, lastname, dischargeDate, patient_Table.[name], rcvd, dis, patient_table.mgr, referrals_DTS.hospital, hospitalcode
From Referrals_DTS INNER Join Patient_Table ON referrals_DTS.account = patient_table.account
where referrals_DTS.hospitalcode = Patient_Table.hospital

Insert INTO #temptable
Select type_indicator + referrals_dts.account as ptaccount, lastname, dischargeDate, patient_Table.[name], rcvd, dis, patient_table.mgr, referrals_dts.hospital, hospitalcode
from (referrals_DTS Inner Join Patient_Table ON referrals_DTS.account = patient_table.account) Left Join Patient_type ON referrals_dts.patienttype = patient_type.patient_type
Where type_indicator + referrals_dts.account = patient_table.account and referrals_DTS.hospitalcode = Patient_Table.hospital

Select * from #temptable

GO
----------------------------------------------------------------------
I get the error message: "Provider Command for Child Rowset Does not Produre a Rowset".

Please help.
Frank
0
Comment
Question by:franksale
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
ragoran earned 500 total points
ID: 12135865
You don't have any parameters or logic.  Have you tried to create a vie instead and bound your report to it:

CREATE VIEW dbo.uvw__Referrals_PotentialDuplicate1
as

Select referrals_dts.Account, lastname, dischargeDate, patient_Table.[name], rcvd, dis, patient_table.mgr, referrals_DTS.hospital, hospitalcode
From Referrals_DTS INNER Join Patient_Table ON referrals_DTS.account = patient_table.account
where referrals_DTS.hospitalcode = Patient_Table.hospital

UNION ALL

Select type_indicator + referrals_dts.account as ptaccount, lastname, dischargeDate, patient_Table.[name], rcvd, dis, patient_table.mgr, referrals_dts.hospital, hospitalcode
from (referrals_DTS Inner Join Patient_Table ON referrals_DTS.account = patient_table.account) Left Join Patient_type ON referrals_dts.patienttype = patient_type.patient_type
Where type_indicator + referrals_dts.account = patient_table.account and referrals_DTS.hospitalcode = Patient_Table.hospital

0
 
LVL 1

Author Comment

by:franksale
ID: 12136051
Humm... That's is a good idea.  It looks like it will work.  Thanks for your help.  

I would still like to know how to send the information out of a stored procedure though.  It seems to work in Query Analyzer.  Other procedures seem to work when I am not using temporary tables.  Any ideas how to get it to work?

Frank
0
 
LVL 14

Expert Comment

by:ragoran
ID: 12136106
My guess is...

Temporary tables exist only dring the scope (e.g. execution time) of the store procedure.  so when the store procedure ends, its temporary object are destroyed (there are temporary after all)...
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

776 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