?
Solved

Access (ADP) Report problem using a stored procedure

Posted on 2004-09-23
3
Medium Priority
?
245 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 1500 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

864 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