deyken
01-17-2012, 02:57 AM
Hi All,
I am attempting to call a simply SP from VBA Code, passing in 4 parameters. The SP need not return any results. It just does a little job using the given parameters on the server side. I get the error: Parameter improperly defined...
Please help? Here is my VBA code:
' Call Stored Procedure for updating the GL_USED Column for this Item Record
Dim DB As New ADODB.Connection
DB.Open "Provider=SQLNCLI10.1;Integrated Security=SSPI;Persist Security Info=False;Data Source=PROJP002D830\SQLEXPRESS;Database=Allowables"
Dim Cmd1 As ADODB.Command
Set Cmd1 = New ADODB.Command
Cmd1.ActiveConnection = DB
Cmd1.CommandText = "UpdateAllowableUsed"
Cmd1.CommandType = adCmdStoredProc
Set prm = Cmd1.CreateParameter("ProjectCode", adString, adParamInput)
Cmd1.Parameters.Append prm
Cmd1.Parameters("ProjectCode").Value = ProjectCode
Set prm = Cmd1.CreateParameter("GLCode", adString, adParamInput)
Cmd1.Parameters.Append prm
Cmd1.Parameters("GLCode").Value = GLCode
Set prm = Cmd1.CreateParameter("ProdDescr", adString, adParamInput)
Cmd1.Parameters.Append prm
Cmd1.Parameters("ProdDescr").Value = ItemDescr
Set prm = Cmd1.CreateParameter("Value", adString, adParamInput)
Cmd1.Parameters.Append prm
Cmd1.Parameters("Value").Value = TotalPrice
Dim AllowUpdated As New ADODB.Recordset
Set AllowUpdated = Cmd1.Execute
AllowUpdated.Open Cmd1
I am attempting to call a simply SP from VBA Code, passing in 4 parameters. The SP need not return any results. It just does a little job using the given parameters on the server side. I get the error: Parameter improperly defined...
Please help? Here is my VBA code:
' Call Stored Procedure for updating the GL_USED Column for this Item Record
Dim DB As New ADODB.Connection
DB.Open "Provider=SQLNCLI10.1;Integrated Security=SSPI;Persist Security Info=False;Data Source=PROJP002D830\SQLEXPRESS;Database=Allowables"
Dim Cmd1 As ADODB.Command
Set Cmd1 = New ADODB.Command
Cmd1.ActiveConnection = DB
Cmd1.CommandText = "UpdateAllowableUsed"
Cmd1.CommandType = adCmdStoredProc
Set prm = Cmd1.CreateParameter("ProjectCode", adString, adParamInput)
Cmd1.Parameters.Append prm
Cmd1.Parameters("ProjectCode").Value = ProjectCode
Set prm = Cmd1.CreateParameter("GLCode", adString, adParamInput)
Cmd1.Parameters.Append prm
Cmd1.Parameters("GLCode").Value = GLCode
Set prm = Cmd1.CreateParameter("ProdDescr", adString, adParamInput)
Cmd1.Parameters.Append prm
Cmd1.Parameters("ProdDescr").Value = ItemDescr
Set prm = Cmd1.CreateParameter("Value", adString, adParamInput)
Cmd1.Parameters.Append prm
Cmd1.Parameters("Value").Value = TotalPrice
Dim AllowUpdated As New ADODB.Recordset
Set AllowUpdated = Cmd1.Execute
AllowUpdated.Open Cmd1