Results 1 to 9 of 9
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Sydney, New South Wales, Australia
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Partial After Update (2003 SP2)

    I have some code to run if any fields on a subform are updated but how can I exclude one field? That is, if any of the other fields are changed I want the code to run but I need one field to be exempt from process to run the code.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Partial After Update (2003 SP2)

    Which event are you using now? The Before Update event of the form?

  3. #3
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Sydney, New South Wales, Australia
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Partial After Update (2003 SP2)

    I am using the AfterUpdate to run code after any change to any of the fields and that works perfectly.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Partial After Update (2003 SP2)

    Just don't put anything in the After Update event of the control you want to except. Or am I missing something?

  5. #5
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Sydney, New South Wales, Australia
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Partial After Update (2003 SP2)

    There are six fields that need to be checked for any change and will therefore cause the code to run. The 7th field needs to be omitted from the after update checking. I mean, in the AfterUpdate event, is it possible to nominate all fields except cboXYZ? I thought about using the AfterUpdate for each individual field as required but that would mean the code could end up running six times and that's not what I need. I need to code to run once only if any of the six fields change but not if the 7th field changes.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Partial After Update (2003 SP2)

    You'll have to tell us in more detail what you are doing. The After Update event of a form doesn't "know" which fields/controls have been updated, so you must either use the After Update events of the individual controls, or devise a method for keeping track which controls have been updated - which would inevitably involve the After Update event of the individual controls.

  7. #7
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Sydney, New South Wales, Australia
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Partial After Update (2003 SP2)

    I suppose that's the point then: if I use the "On Dirty" event to set an individual boolean variable for each required control, then on the forms AfterUpdate, if any of the boolean variables are true, then the code can run.

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Partial After Update (2003 SP2)

    I'd use the After Update event of the controls instead of the On Dirty event. The On Dirty event occurs when the user starts editing the value of a control; the user might still cancel the edit (by pressing Esc). The After Update event only occurs if the value is actually updated.
    You can use one boolean variable that is set to True in the After Update event of the relevant controls, and is reset to False in the On Current event and After Update event of the form.

  9. #9
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Sydney, New South Wales, Australia
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Partial After Update (2003 SP2)

    Thanks Hans for your sound advice!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •