Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Feb 2003
    Location
    Clear Spring, Maryland, USA
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Form OnUpdate (XP)

    I added a date field to my table called "datechanged". I then added that field to the query that my main form uses as its control. When I added that field to the form and populated it through the form's "AfterUpdate" event I could no longer add any new records. I did set that field to non-tab and locked, but taking those off didn't make any difference. The word "calculating" flashes then I end up back to same record. What might be going on?

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Form OnUpdate (XP)

    I'd put the code in your form's BeforeUpdate event. If you put it in AfterUpdate, you are immediately dirtying the form again! I could foresee this causing a looping effect, because each time you then move off the record you hit the AfterUPdate, which updates that field, which dirties the record, etc.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Lounger
    Join Date
    Feb 2003
    Location
    Clear Spring, Maryland, USA
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form OnUpdate (XP)

    I'll try it, but I want to make sure that the value of that field doesn't change by simply looking at a record on the form, but only when something actually gets changed. Will the BeforeUpdate do that?

  4. #4
    Star Lounger
    Join Date
    Feb 2001
    Location
    Olympia, WA, Washington, USA
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form OnUpdate (XP)

    I have similar datechanged items in my database. I approached it differently. I only wanted to know when the address was changed (address1, address2, city, state and/or zip). I put the code in the after update in each of these controls so when they are changed the date control is changed. Just looking doesn't do anything you have to actually change something.

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

    Re: Form OnUpdate (XP)

    It's OK, BeforeUpdate only occurs if the user has actually changed one or more field values.

  6. #6
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Form OnUpdate (XP)

    Both the BeforeUpdate and AfterUpdate events only fire if you have made a change to a record and are attempting to save it. The BeforeUpdate event fires just before the record is actually saved, giving you the opportunity to add extra validation code (allowing you to Cancel the save operation if necessary) or any other code you want. Merely looking at a record doesn't make it "dirty", so Access won't try to save it.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

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