• Before Update v. After Update (A97)

    Author
    Topic
    #373695

    We have a report generated from a table of contract proposals that includes a “status” field. This field is a memo field, and is intended to allow a paragraph or two of commentary on active proposals (just too long for a 255 character text field, unfortunately). I would like to include the date that the status commentary was last updated, so I have added a “CommentDate” field to the table, and will use either a before update or after update event on the “status” text box on the form where it is entered to change the value of the CommentDate field to the current system date. Is there any reason to prefer ‘before’ or ‘after’ update? It seems that ‘before update’ is better suited to data validation, but other than that are there reasons to choose one over the other?

    Viewing 0 reply threads
    Author
    Replies
    • #601603

      Under normal circumstances, the AfterUpdate event is where you would place the code you talked about.

      Now, in your example, this probably won’t matter. But with another situation, you might have some field validations defined in the table which are checked AFTER the BeforeUpdate event, but BEFORE the AfterUpdate. So you wouldn’t want to update that date field until you KNEW that your first field had indeed been changed. This can only mean the AfterUpdate event.

      • #601607

        Okay – I see why you would prefer one over the other – if you perform some data validation and the changes are rejected, you have still fired the Before Update event and triggered whatever actions flow from that …
        As you say, it is not a consideration in this instance, but is something to keep in mind for the future – thanks for the heads up!

    Viewing 0 reply threads
    Reply To: Before Update v. After Update (A97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: