I want to append the record based on the combo selection id. I am using the following code. Can any one please correct me where i am going wrong. I have copied the code from a book as i am not much familiar with VB.
When i run the following code, it gives error "Object Required".
Private Sub Command30_Click()
On Error GoTo Err_Command30_Click
Dim cnn As ADODB.Connection
Set cnn = CurrentProject.Connection
Dim cmd1 As ADODB.Command
Set cmd1 = CreateObject("ADODB.Command")
cmd1.ActiveConnection = cnn
cmd1.CommandType = 4 'This is the datatype field size
cmd1.CommandText = "z2" 'Name of the stored procedure
Dim prm1 As ADODB.Parameter
Set prm1 = cmd1.CreateParameter(id, adint, adParamInput, 4, Me.Combo8)
cmd1.Parameters.Append prm2
cmd1.Execute
Exit_Command30_Click:
Exit Sub
Err_Command30_Click:
MsgBox Err.Description
Resume Exit_Command30_Click
End Sub
ID is the field name/bound column selection for the combo with data type Int(4).
Any suggestion
Dwight
When i run the following code, it gives error "Object Required".
Private Sub Command30_Click()
On Error GoTo Err_Command30_Click
Dim cnn As ADODB.Connection
Set cnn = CurrentProject.Connection
Dim cmd1 As ADODB.Command
Set cmd1 = CreateObject("ADODB.Command")
cmd1.ActiveConnection = cnn
cmd1.CommandType = 4 'This is the datatype field size
cmd1.CommandText = "z2" 'Name of the stored procedure
Dim prm1 As ADODB.Parameter
Set prm1 = cmd1.CreateParameter(id, adint, adParamInput, 4, Me.Combo8)
cmd1.Parameters.Append prm2
cmd1.Execute
Exit_Command30_Click:
Exit Sub
Err_Command30_Click:
MsgBox Err.Description
Resume Exit_Command30_Click
End Sub
ID is the field name/bound column selection for the combo with data type Int(4).
Any suggestion
Dwight