Results 1 to 4 of 4
  1. #1
    m3atball is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Los Angeles, CA
    Posts
    9

    "Update or CancelUpdate without AddNew or Edit" when changing combo box selections

    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
    Last edited by m3atball; 03-07-2011 at 08:37 PM. Reason: update status = solved

  2. #2
    ajetrumpet is offline Banned
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    why are you using that code? what's the purpose? I know it's for a bookmark, but why are you doing that?

    the reason I ask is simply because a lot of times, explaining why error exists to someone can take days more time than offering a workaround solution so the error doesn't ever exist.

  3. #3
    m3atball is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Los Angeles, CA
    Posts
    9
    Adam -

    Thanks for the quick reply! I have limited knowledge on combo boxes. All I know is that, the two lines of FindFirst and bookmark code seem to be the "standard" After_Update() events. All my existing (simple one-table forms) have them and are working so I didn't take them out. All I really need, is for the selected value to stick with the combo box (so I can assign it to the global variable - this part is working). In this Add-USER form, there is no subform/table associated with the selection for bounded display purposes. I can certainly remove the bookmark if it is just white noise.

    I wonder if something is missing from the After_Update() event that causes the error.

    ~M3atball

  4. #4
    m3atball is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Los Angeles, CA
    Posts
    9
    It worked after I removed the bookmark line! Woohoo! Thanks again Adam!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Update or CancelUpdate without AddNew or Edit
    By westcoastbmx in forum Forms
    Replies: 5
    Last Post: 11-07-2019, 09:01 PM
  2. Replies: 6
    Last Post: 07-25-2012, 06:42 AM
  3. Replies: 9
    Last Post: 04-01-2011, 10:31 AM
  4. Replies: 8
    Last Post: 11-12-2010, 10:55 AM
  5. Creating "Edit Record" link in table column
    By joshearl in forum Forms
    Replies: 1
    Last Post: 12-25-2009, 11:17 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums