Results 1 to 10 of 10
  1. #1
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,067

    After Update Event

    For a field on a form when does the After UPdate Event actually fire? If I'm on the form in an existing record and update the field it fires. However, when I'm on the form and entering a new record the After UPdate Event for a particular field doesn't fire anyone know why?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The event fires when the contents of the control are manually changed by the user. If you've populated it via code or default value, it does not fire.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,466
    Ray sounds like you maybe be confused with AfterUpdate event on the Form versus on a Control? You can have AfterUpdate on the Form which will fire when your record is saved or AfterUpdate on the crotrol which will fire off after you update that control value and leave the control. Even if you are on a new record, once you enter data into that field and move off of it, the AfterUpdate on that control will fire if you have code there.

  4. #4
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,067
    The control is on a Data Entry Form. In the After Update Event of 3 controls (lastname, firstname and DOB) I have the following code:

    Code:
    If Not Isnull(me.lastname) and not isnull(me.firstname) and not isnull(me.dob) Then
        me.personkey = Trim(left(lastname,4)) & Trim(left(firstname,4)) & Trim(format(me.dob,"mmddyyyy"))
    End if

    If a record exists and I modify any of those fields the Me.PersonKey field is populated as it should be. However If I enter a new record type in all of the data for that record and then move to another record the PersonKey field in the table is still blank. If I go back to that record and change any of those 3 fields the PersonKey field is populated.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Can you attach the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,466
    "However If I enter a new record type in all of the data for that record and then move to another record" don't understand this part. Do you mean you move to a new record? Those events should trigger even if on a new record. If you are updating a different field "recordtype"? in the same record, then no they won't trigger since you are not updating those specific fields with the AfterUpdate property code. In that case you would need to add that code to the BeforeUpdate on the Form.

  7. #7
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,067
    CRMNewtest.zip


    Here's the file. The Actual Data is in SQL Server saved the table I need in the local MS Access 2010 DB.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Enter them in a different order, one of the names last. Hint, check the date textbox code.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,067
    Ok Thanks, PBaldy Guess I had my stupid cap on this morning. I forgot I changed the name of the textbox due to another issue I was having. It's fixed now thanks for the help

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem. Wish I could say I'd never done it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 6
    Last Post: 11-05-2014, 05:27 PM
  2. Replies: 7
    Last Post: 05-08-2014, 10:34 AM
  3. VBA in Before Update Event
    By data808 in forum Access
    Replies: 1
    Last Post: 02-21-2014, 07:15 PM
  4. Before Update Event Help
    By bklewis in forum Access
    Replies: 8
    Last Post: 03-25-2012, 03:58 PM
  5. Before Update Event
    By randolphoralph in forum Programming
    Replies: 0
    Last Post: 06-15-2010, 09:26 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