S
Sunny
This is my stored procedure on SQL server"
CREATE PROCEDURE CalculateSales
@SalesAmt money = 0 OUTPUT,
@SalesmanId char(10)
AS
Begin
code...
end
Following is the code in vba to call stored procedure:
Dim adoCommand As Command
Dim objParam As Parameter
Set adoCommand = New Command
adoCommand.CommandText = "CalculateSalesl"
adoCommand.CommandType = adCmdStoredProc
Set adoCommand.ActiveConnection = cnObject
Set objParam = adoCommand.CreateParameter("@SalesAmt", adCurrency,
adParamOutput, , 0)
adoCommand.Parameters.Append objParam
Set objParam = adoCommand.CreateParameter("@SalesmanId", adChar,
adParamInput, , "Adam ")
adoCommand.Parameters.Append objParam
adoCommand.Execute
nSales = adoCommand.Parameters(0)
Set adoCommand = Nothing
When I run vba code I get this error:
Type mismatch on line Set objParam = adoCommand.CreateParameter("@SalesAmt",
adCurrency, adParamOutput, , 0)
What am I doing wrong here? Please advice me.
Thanks for looking into it.
CREATE PROCEDURE CalculateSales
@SalesAmt money = 0 OUTPUT,
@SalesmanId char(10)
AS
Begin
code...
end
Following is the code in vba to call stored procedure:
Dim adoCommand As Command
Dim objParam As Parameter
Set adoCommand = New Command
adoCommand.CommandText = "CalculateSalesl"
adoCommand.CommandType = adCmdStoredProc
Set adoCommand.ActiveConnection = cnObject
Set objParam = adoCommand.CreateParameter("@SalesAmt", adCurrency,
adParamOutput, , 0)
adoCommand.Parameters.Append objParam
Set objParam = adoCommand.CreateParameter("@SalesmanId", adChar,
adParamInput, , "Adam ")
adoCommand.Parameters.Append objParam
adoCommand.Execute
nSales = adoCommand.Parameters(0)
Set adoCommand = Nothing
When I run vba code I get this error:
Type mismatch on line Set objParam = adoCommand.CreateParameter("@SalesAmt",
adCurrency, adParamOutput, , 0)
What am I doing wrong here? Please advice me.
Thanks for looking into it.