I have created a sql sp with a cmd prompt to run sp with parameters to update form and receive error "parameter is improperly defined. Inconsistent or incomplete information was provided." I have posted code below and would appreciate input. Thank you!
Private Sub Update_Record_Click()
'Declare new connection and recordset
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim icd_id as Parameter
Dim pt_id as Parameter
Dim vdt_con as Parameter
Dim cons_dt as Parameter
Dim vdt_hip1 as Parameter
Dim hipa_dt as Parameter
Set adoConnection = New ADODB.Connection
Set adoRecordset = New ADODB.Recordset
Set cmd = New ADODB.Command
With cmd
.ActiveConnection = CurrentProject.Connection
.CommandText = "procConsentUpdate"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter( _
"RETURN_VALUE", adInteger, adParamReturnValue)
.Parameters.Append .CreateParameter( _
"icd_id", adInteger, adParamnput, , Me.icd_id)
.Parameters.Append .CreateParameter( _
"pt_id", adInteger, adParamInput, , Me.pt_id)
.Parameters.Append .CreateParameter( _
"vdt_con", adsmalldatetime, adParamInput, , Me.vdt_con)
.Parameters.Append .CreateParameter( _
"cons_dt", adsmalldatetime, adParamInput, , Me.cons_dt)
.Parameters.Append .CreateParameter( _
"vdt_hip1", adsmalldatetime, adParamInput, , Me.vdt_hip1)
.Parameters.Append .CreateParameter( _
"hipa_dt", adsmalldatetime, adParamInput, , Me.hipa_dt)
.Execute
End With
End Sub
Private Sub Update_Record_Click()
'Declare new connection and recordset
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim icd_id as Parameter
Dim pt_id as Parameter
Dim vdt_con as Parameter
Dim cons_dt as Parameter
Dim vdt_hip1 as Parameter
Dim hipa_dt as Parameter
Set adoConnection = New ADODB.Connection
Set adoRecordset = New ADODB.Recordset
Set cmd = New ADODB.Command
With cmd
.ActiveConnection = CurrentProject.Connection
.CommandText = "procConsentUpdate"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter( _
"RETURN_VALUE", adInteger, adParamReturnValue)
.Parameters.Append .CreateParameter( _
"icd_id", adInteger, adParamnput, , Me.icd_id)
.Parameters.Append .CreateParameter( _
"pt_id", adInteger, adParamInput, , Me.pt_id)
.Parameters.Append .CreateParameter( _
"vdt_con", adsmalldatetime, adParamInput, , Me.vdt_con)
.Parameters.Append .CreateParameter( _
"cons_dt", adsmalldatetime, adParamInput, , Me.cons_dt)
.Parameters.Append .CreateParameter( _
"vdt_hip1", adsmalldatetime, adParamInput, , Me.vdt_hip1)
.Parameters.Append .CreateParameter( _
"hipa_dt", adsmalldatetime, adParamInput, , Me.hipa_dt)
.Execute
End With
End Sub