I have a persistent error on all my forms with combo boxes where the combo box is picking value from a different table than the main data source of this form. Whenever I select a new value from the combo box a second time (i.e. select one value then select a different value), the "Update or CancelUpdate without AddNew or Edit" error will come up starting from that 2nd selection and happen to all subsequent selection changes. The newly selected value does appear on the combo box after okaying the error.
One example is a very simple form used for adding new users (i.e. creating a new record in the EMPLOYEES table). There is one combo box on top of the form where an office should be selected when adding the user. OFFICE table contains a unqiue list of offices and their respective regions. The EMPLOYEES table contains a field that holds the primary key of the OFFICE table.
There is nothing complicated behind the "After_Update" event on this combo box other than the standard FindFirst and bookmark code, and a global variable assignment.
I did notice that this error does not occur on my other forms where all information on the form is coming from the same table. So I suspect multiple tables on the form may have something to do with this. I was wondering if anybody could help me avoid or suprress this error. Thank you in advance for your help!
Here is the combo box's After_Update() event:
Code:
Private Sub cboOffice_AfterUpdate()
Me.RecordsetClone.FindFirst "[OFFICE] = '" & Me![cboOffice] & "'"
officeSelection = Me![cboOffice]
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub
Form Data Source: a query selecting all fields from EMPLOYEE table
Combo box Data Source: a query selecting all fields from OFFICE table, bound on OFFICE field