How to know when a record has been "undone"

  • Thread starter Thread starter David Portwood
  • Start date Start date
D

David Portwood

On a subform I have a record with one unbound field. If the user cancels
changes, I want to blank that field. Is there an "Undo" event that I can
hook my code to?
 
Both the control and the form have Undo events.

But I'm not clear what you are aiming for here. If the user undoes the
record or the field, it reverts back to its previous value. For an existing
record, that's the value when it was previously saved. For a new record,
that *is* blank without you needing to do anything (unless there's a Default
Value.)
 
The control is unbound, so I don't think Undo applies to the control. Also,
the unbound control is on a subform, so I don't think the Undo event of the
form works. I don't recall seeing an Undo event for the subform. Just Enter
and Exit, as I recall.

The other fields on the subform are all bound, so if the user presses Esc
all the other controls revert to their original state but not the unbound
control.

Do you have any suggestions?
 
I don't recall seeing an Undo event for the subform. Just Enter
and Exit, as I recall.

The *subform control* - the container - doesn't have an Undo event, but the
Form within that control does.

John W. Vinson [MVP]
 
Sorry, David, I missed the word "unbound" in your original post.

As John explained, there is a difference between the subform *control*, and
the form *in* the subform control.

The form (in the subform control), has events such as Current, BeforeInsert,
and Undo. Assuming the subform is bound to a table/query, you should be able
to use its Undo event.

(BTW, Form_Undo was introduced in Access 2000, so it won't be there in A97
or earlier.)
 
I'm on my way to work, I'll give it a try. Sounds like what I'm looking for.

My thanks to you and John.
 

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

Back
Top