Results 1 to 2 of 2
  1. #1
    fhickler is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Nov 2018
    Posts
    30

    Temporarily turn off beforeupdate trigger?


    I have a subform that has a beforeupdate action associated with it. I want the resulting action to occur when anyone explicitly updates any field in the subform. I also have a button on the main form that modifies the values of certain fields on the subform. This seems to also trigger the beforeupdate action. Is there any way to get it to only perform the beforeupdate action when someone explicitly changes a field, but not when a field is changed via VBA?

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    7,127
    There may be a better approach but can't say based on the info. Having beforeUpdate events on a form as well as all of its controls seems like overkill.
    I've never tried, but here's a notion
    - declare a form level variable (Boolean?) and set it as the very first button code line. In form update, check that variable and Cancel = True if it has the right value.

    However, being able to cancel the form level event seems dangerous to me and implies that if it's sometimes unnecessary, it is not of much use. It will fire if the user attempts to leave the record, so why not just have one or the other? Maybe more info as to why you have both would allow for more focused answers.
    - "doesn't work" doesn't help. Implement changes in copies of your database.
    "Everyone has a photographic memory; some just don't have film." Steven Wright

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

Similar Threads

  1. Can I set Popup = True temporarily
    By PeakH in forum Reports
    Replies: 5
    Last Post: 05-07-2018, 02:18 PM
  2. Anyway to "Temporarily" turn on cascade deletes
    By GraeagleBill in forum Programming
    Replies: 3
    Last Post: 08-24-2016, 05:12 PM
  3. Replies: 11
    Last Post: 05-19-2015, 08:35 AM
  4. How to store values temporarily
    By Naveen Marapaka in forum Programming
    Replies: 8
    Last Post: 12-29-2012, 10:07 AM
  5. Temporarily Disable Multifield Index
    By datsyuk in forum Forms
    Replies: 6
    Last Post: 07-23-2012, 03:23 PM

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 - Senior Forums