Solved

Access (ADP) Report problem using a stored procedure

Posted on 2004-09-23
3
237 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of utilizing SQL Server functions 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 Microsoft Ac…
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…

728 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

10 Experts available now in Live!

Get 1:1 Help Now