Results 1 to 4 of 4
  1. #1
    ts_hunter is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2014
    Posts
    30

    Question Insert record triggers 'After Update' AND 'After Insert'

    I have a form (frmEdit) that I call to edit record, and I call it with datamode set to adFormAdd to insert records. When I update records, the 'after Update' event triggers. When I insert records, the 'after Update' AND 'after Insert' events trigger. Any idea why?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Is there code in the afterupdate and afterinsert trigger?
    If so, then it is behaving correctly. (you both updated AND inserted)

    NOTE: if you click EDIT , why is it ADDING records instead of EDITING existing records?

  3. #3
    ts_hunter is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2014
    Posts
    30
    Quote Originally Posted by ranman256 View Post
    Is there code in the afterupdate and afterinsert trigger?
    If so, then it is behaving correctly. (you both updated AND inserted)

    NOTE: if you click EDIT , why is it ADDING records instead of EDITING existing records?
    When I insert a new record, how am I updating and inserting? Aren't I only inserting a new record?

    When I use the form to Edit a record, it only edits(updates) the record.

    And yes, I have code in both afterupdate and afterinsert....

  4. #4
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    It is curious. According to MS, the order of form record events for creating new records is

    Current (form) > Enter (control) > GotFocus (control) > BeforeInsert (form) > AfterInsert (form)
    The BeforeUpdate and AfterUpdate events for the controls on the form and for the new record occur after the BeforeInsert event and before the AfterInsert event.

    I guess you are sure that the Update event is not running for a control on the form and not the form itself?

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

Similar Threads

  1. INSERT query: insert new data only
    By drh in forum Access
    Replies: 2
    Last Post: 04-04-2014, 05:31 PM
  2. Replies: 7
    Last Post: 02-26-2013, 10:37 AM
  3. UPDATE and INSERT
    By csako1 in forum Access
    Replies: 3
    Last Post: 01-05-2012, 06:37 PM
  4. if exists UPDATE else INSERT
    By lloyddobler in forum Programming
    Replies: 18
    Last Post: 01-04-2012, 11:35 PM
  5. update vs. delete / insert
    By markjkubicki in forum Programming
    Replies: 1
    Last Post: 09-23-2010, 07:44 AM

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