T
T.J. Bernard
I am working on an ADP project in which I want to update
my table using a stored procedure. The update is written
as a stored procedure that has two input parameters. One
parameter determines the correct record (unique ID) the
other parameter is the value to update the specified field
to. These values are determined on a form, so when a
certain record is displayed and the update value is
entered, a button is clicked and I am currently running
the following code:
Dim cnn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As New ADODB.Recordset
Dim Param1 As ADODB.Parameter
Dim Param2 As ADODB.Parameter
Dim UsageDec As String
Dim TapeNum As String
Usage.Setfocus
UsageDec = Usage.Text
Tape.Setfocus
TapeNum = Tape.Text
Set cnn = CurrentProject.Connection
Set cmd.ActiveConnection = cnn
Set Param1 = cmd.CreateParameter("Input", adInteger,
adParamInput)
cmd.Parameters.Append Param1
Param1.Value = UsageDec
Set Param2 = cmd.CreateParameter("Input2", adVarChar,
adParamInput)
cmd.Parameters.Append Param2
Param2.Value = TapeNum
cmd.CommandText = "qryUpdateUsageUnknown2"
cmd.CommandType = adCmdStoredProc
cmd.Execute
Everytime the code breaks at "cmd.Parameters.Append
Param2" with the error: "Run-time error 3708. Parameter
Object is improperly defined. Inconsistent or incomplete
information was provided."
I am not sure why I am getting this error. I am using ADO
2.6 library.
If anyone has any ideas let me know.
Thank you,
T.J.
my table using a stored procedure. The update is written
as a stored procedure that has two input parameters. One
parameter determines the correct record (unique ID) the
other parameter is the value to update the specified field
to. These values are determined on a form, so when a
certain record is displayed and the update value is
entered, a button is clicked and I am currently running
the following code:
Dim cnn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As New ADODB.Recordset
Dim Param1 As ADODB.Parameter
Dim Param2 As ADODB.Parameter
Dim UsageDec As String
Dim TapeNum As String
Usage.Setfocus
UsageDec = Usage.Text
Tape.Setfocus
TapeNum = Tape.Text
Set cnn = CurrentProject.Connection
Set cmd.ActiveConnection = cnn
Set Param1 = cmd.CreateParameter("Input", adInteger,
adParamInput)
cmd.Parameters.Append Param1
Param1.Value = UsageDec
Set Param2 = cmd.CreateParameter("Input2", adVarChar,
adParamInput)
cmd.Parameters.Append Param2
Param2.Value = TapeNum
cmd.CommandText = "qryUpdateUsageUnknown2"
cmd.CommandType = adCmdStoredProc
cmd.Execute
Everytime the code breaks at "cmd.Parameters.Append
Param2" with the error: "Run-time error 3708. Parameter
Object is improperly defined. Inconsistent or incomplete
information was provided."
I am not sure why I am getting this error. I am using ADO
2.6 library.
If anyone has any ideas let me know.
Thank you,
T.J.