Undo change in subform

  • Thread starter Thread starter Terry
  • Start date Start date
T

Terry

What is the best method for undoing changes in a subform from a command
button on a mainform? The subform is bound to a table on the many side of a
one-to-many with the main form.

Tried Me.subformname.Form.Undo

and

Me.subformname.Setfocus
DoCmd.RunCommand acCmdUndo

Regards
 
That's not going to work well, Terry.

Access has to move the focus to the main form before it can make the command
button active and run its code. Before it can do that, it has to save the
record in the subform. That's exactly what you don't want.

Train your users to use the <Esc> key to undo the subform record.
Alternatively, get them to use the Undo button on the toolbar, or choose
Undo from the Edit menu.
 
Thanks Allen,
I realised after I posted why my previous attempts would not work, you're
right with pointing out the focus changes thus saving the record in the
subform. It's not too much of a problem as I have allowed edits and
deletions in the subform.
Regards
 

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