View Full Version : Error "Update or CancelUpdate without AddNew or Edit"


gsanghvi20
07-31-2008, 01:19 PM
Hey guys,

I have a form which has a many text boxes and a combobox. One of the text boxes and the combobox form the composite PK. The value of the PK text box is taken from another from. And based on that I select the combobox values.

eg: I have the first name of a person in one txt box in one form, and the last name in the form of a combobx in another form.

Form 1:
First Name: John

Form 2:
First Name: John (disabled>value taken from Form 1)
Last Name: Drop down of available last names with John as a first name.
...
...
List of the other attributes in the table.

Now I want that when I select a Last Name it gives me all the attributes in the respective text boxes. I have done all the needful according to me. But the data in the respective text boxes on selecting the Last Name does not give me anything. When I go ahead and try to update any field it gives me an error: "Update or CancelUpdate without AddNew or Edit".

Please tell me what to do.http://www.vbaexpress.com/forum/images/smilies/100.gif

Thanks,
gsanghvi20

CyberLynx
08-01-2008, 05:59 AM
In the Form2 code Module for the OnClick event of the Last Name Combo Box:

Me.RecordSource = "Select * From MyTableName WHERE FirstName='" & _
Me.cboFirstName.Value & "' AND LastName='" & _
Me.cboLastName.Value & "';"


.