how can i put data from an access datafield to a datacombo?so that each time i click the data combo it will show the data that is stored in the access file it is connected.

here is my code:

Private Sub cboCustomerID_Change()
On Error Resume Next
If blnID = True Then
Me.AdoCustomers.Recordset.MoveFirst
Me.AdoCustomers.Recordset.Find "customerid ='" & Me.cboCustomerID.Text & "'"
Me.cboCustomerName.Text = Me.AdoCustomers.Recordset!customername
Me.txtAddress.Text = Me.Recordset!physicaladdress
End If
End Sub

but each time i run the program it points to the Private Sub part and says that it is not a valid declaration.

thanks.

Recommended Answers

All 3 Replies

Private Sub cboCustomerID_Change()

Change the above to the cboCustId_Click or lost focus event. This should solve your problem.

yeah thanks i changed it to private sub cboCustomerID_Change and it worked.
thanks.

Its a pleasure. Just mark as solved, thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.