Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Jun 2002
    Location
    Barnsley, Yorkshire, England
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Aborted changes to records.... (NT4 SP5, Access 97 SR2)

    Hi Everyone

    I'm sure this is an easy one for those who know the answer, but as usual it's a bit more difficult for those who don't <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    Like most of us, i display confirmation messages on the Before Update event to users when records have been changed etc.

    Some users have commented that if they make a change in a field, and the retype or reselect the original value without commiting the change, they still get the confirmation message, and their username is appended as the last user to modify that record.

    This is, i presume, because the Before Update event senses that a field value has been changed, but not that the final value is actually the same as the original value.

    How does everyone get round this?????

  2. #2
    2 Star Lounger
    Join Date
    Jun 2002
    Location
    Barnsley, Yorkshire, England
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Aborted changes to records.... (NT4 SP5, Access 97 SR2)

    A thought...... should i be using the .Dirty property???????

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Edmonton, Alberta, Canada
    Posts
    326
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Aborted changes to records.... (NT4 SP5, Access 97 SR2)

    Using the Dirty property won't help either. If somebody changes a field and then changes it back again, Access still sees that as a change.

    Teach your users about the Esc key. Hitting it twice cancels the changes to the current record (twice, because if you are making changes to a field then the first Esc cancels the changes to the field and the second the changes to the record).

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Aborted changes to records.... (NT4 SP5, Access 97 SR2)

    Try the AfterUpdate event instead. Use the BeforeUpdate if you want the user to confirm that they really want to make the change, but use the AfterUpdate to tell them that it happened.
    Charlotte

  5. #5
    2 Star Lounger
    Join Date
    Jun 2002
    Location
    Barnsley, Yorkshire, England
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Aborted changes to records.... (NT4 SP5, Access 97 SR2)

    Hi

    Thank you both for your comments. I've spent a good couple of hours this morning exploring the subtleties of the AfterUpdate and BeforeUpdate events, but still have the same problem:

    If someone changes a value, and without saving or exiting, changes it back to what it was originally, Access still thinks the record has been changed. (Well i know it has, but on a net basis, nothing has really been changed, i.e. the record is exactly the same as it was when the form was opened).

    How do i get Access to realise that nothing has been changed, or is this not actually possible???

  6. #6
    Star Lounger
    Join Date
    Feb 2001
    Location
    Wirral, Merseyside, Merseyside, England
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Aborted changes to records.... (NT4 SP5, Access 97 SR2)

    I solved this same problem a different way,though it was quite complex, I did it this way as I am retaining an audit trail of change so I was writing out the specific change to another field.

    On current I set 2 sets of variables to the values of each of the fields. Say Variable1 = me.field1 and NewVariable1 = me.field1

    Then after the update of field1, I set the NewVariable1 to the me.field1 again. I then have 2 variable values to compare to see whether a change has been made.

    I also caputure the Esc key so that when esc is pressed both Variable1 = me.field1 and NewVariable1 = me.field1 again.


    Complex and painfull I know, especially as you'll have to cater for Nulls but it will work. If you want the code I'll send it to you.

  7. #7
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Edmonton, Alberta, Canada
    Posts
    326
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Aborted changes to records.... (NT4 SP5, Access 97 SR2)

    If you really want to check whether all the data is the same as it was initially, the easiest way would be to compare field.value with field.oldvalue for all the fields in your form (take a look at the help for the oldvalue property).

    However, again I would suggest simply teaching your users that changing a field and then changing it back still constitutes a change, and teaching them what the Esc key is for.

Posting Permissions

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