View Full Version : Combo Box Error


MAXGIZ
05-24-2007, 11:18 AM
Good Day

I'm busy with a project, i have a database with tables where the forms are connected to, in my forms that i have created i have change the boxes that was created by the forms wizard to a combo box, i need to program this combo box so that when i click on it i can select a certain number the data that is attach to will be displayed....i have created a new combox and looked at the code(as i'm a beginer with this) i've copied the code and went to the combo box that doesn't work, pasted the code but as soon as i select a number it gives the following error: Update or CancelUpdate without AddNew or Edit. (Error 3020) below is the code that i used:

Private Sub CL_NR_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[CL_NR] = '" & Me![CL_NR] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

End Sub

boblarson
05-24-2007, 11:33 AM
It looks like you put this in the wrong AfterUpdate event. You need it on the COMBO Box's AfterUpdate event and if you are using it to do this the combo box you are using should not be bound to a field.

Also, hopefully you didn't paste the event (this part: Private Sub CL_NR_AfterUpdate()as well because Access doesn't like to have more than one of the same event, plus IT manages the events and you can't just add one.

MAXGIZ
05-24-2007, 11:43 AM
I copied the code and change it as to the combo box name, i had i look at it again, and i've changed the control source and it's working....


Thanks for the quick reply.....
:)

boblarson
05-24-2007, 11:45 AM
Glad you got it sorted. :)