Using Access VBA to get the varpar OUTPUT parameter from a SQL Server stored procedure

I have the following stored procedure on a SQL server and you can simply call it in SQL Server:

CREATE PROCEDURE uspRecipeNote
    @IngString varchar(255) OUTPUT,
    @MixID int = NULL
AS 
    SET NOCOUNT ON;
    SET @IngString = dbo.ufnRecipeNote(@MixID);

I have been using VBA in Access to call stored procedures for several months and never had a problem, but tried several features and was stumped, getting one of the following errors, depending on what I tried:

"The parameter object is incorrectly defined. Inconsistent or incomplete information provided." "The procedure or function uspRecipeNote contains too many arguments."

Here is what I have at this point in VBA:

Set cmd.ActiveConnection = cn
cmd.CommandTimeout = 0
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "uspRecipeNote"

'add parameters
cmd.Parameters.Append cmd.CreateParameter("@IngString", adVarChar, adParamOutput)
cmd.Parameters.Append cmd.CreateParameter("@MixID", adInteger, adParamInput, , intMixID)

cmd.Execute

I get an error on the first parameter no matter what I tried. I suspect this is something simple. Thanks in advance for your help!

+4
2

() , ,

cmd.Parameters.Append cmd.CreateParameter("@IngString", adVarChar, adParamOutput, 255)
+5

, . , , SP VBA ( varchar - , Gord). !

0

All Articles