Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: Stored Procedure with Output Parameter Doesn't Return Data


View products that this article applies to.

This article was previously published under Q225948
Advanced: Requires expert coding, interoperability, and multiuser skills.

This article applies only to a Microsoft Access project (.adp).

↑ Back to the top


Symptoms

When you try to run a stored procedure that uses an output parameter to return data from within a Microsoft Access project (.adp), you are prompted for any input parameter(s) as well as the ouput parameter. After you enter the parameter(s), you receive the following message:
The Stored Procedure executed successfully but did not return records.

↑ Back to the top


Resolution

To run a stored procedure that contains output parameters from within an Access project, create a second stored procedure that nests the original procedure. Then you can run the new stored procedure instead. The following example demonstrates how to implement this technique:
  1. First, complete the steps in "Steps to Reproduce Problem" section of the "More Information" section later in this article.
  2. Create a new stored procedure, and enter the following text:
    CREATE PROCEDURE OutputSqrrt
    (
       /* Input Parameter used to prompt user for value */ 
    
       @EnterValue int
     )
    AS
       /* variable used to return the result */ 
       Declare @OutputResult int 
    
       /* Call First Stored Procedure, storing the result in @OutputResult */ 
       Execute Sqroot @EnterValue,  @OutputResult OUTPUT
       
       SELECT  @OutputResult as long
    					

↑ Back to the top


More information

Steps to Reproduce Behavior

  1. Open the sample Access project, NorthwindCS.adp.
  2. In the Database window, click Stored Procedures under Objects, and then click New.
  3. In a new stored procedure window, enter the following text:
    CREATE PROCEDURE Sqroot
       (
          @EnterValue int,
          @Result int OUTPUT
       )
    AS
       SELECT @Result = SQRT(@EnterValue)
    					
  4. Close and save the stored procedure as "Sqroot" (without quotation marks).
When you run the stored procedure that you've just created, you are prompted for both the input parameter and the output parameter. When you click OK on the prompt for the output parameter, Microsoft Access returns the following message:
The Stored Procedure executed successfully but did not return records.

↑ Back to the top


Keywords: KB225948, kbclientserver, kbprb

↑ Back to the top

Article Info
Article ID : 225948
Revision : 2
Created on : 6/29/2004
Published on : 6/29/2004
Exists online : False
Views : 315