access 2007 / beforeUpdate in a form

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
 
A

Allen Browne

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.)
 
A

Alain Bourgeois

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top