Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code to Append record based on combo selection

Status
Not open for further replies.

dwight1

IS-IT--Management
Aug 22, 2005
176
US
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
 
Is this a front-end/back-end type database? Which part is in Access?
 
I am using MS Access (Adp) as the front end and sql as the back end.

The click event is on a button on MS Access Form.

Hope this helps.

Dwight
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top