access 2007 / beforeUpdate in a form

  • Thread starter Thread starter Alain Bourgeois
  • Start date Start date
A

Alain Bourgeois

Dear all,

From access 2003 on-line doc abour the BeforeUpdate of a control in a
form:
"If the user enters a new value in the control, the OldValue property
setting isn't changed until the data is saved (the record is updated).
If you cancel an update, the value of the OldValue property replaces the
existing value in the control."

However, in access 2007, If I cancel an update, the value of the
OldValue property doesn't replace the existing value in the control.=>
Is it possible to get the same behaviour (re-changing the value triggers
another beforeUpdate event)?

Regards and thanks for your help,
Alain
 
Alain, can you provide some more information about this problem?

I presume we are talking about a control that is bound to a field.
If you cancel the update with something like this:
Me.Undo
then Access should replace whatever change you made with the old value.

Is this what you are doing? Or are you doing something like this:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Cancel = True
Debug.Print Me.Text0.Value, Me.Text0.OldValue
End Sub
In this case you have cancelled the event, but the old value has not yet
been restored (i.e. the undo has not yet been executed.)
 
Thank you Allen, it works.
I didn't know I had to write a me.undo after cancel=true.
I thought this error was due to another "beforeUpdate" bug/behaviour
change in access 2007.


Regards,
Alain
 
Back
Top