Solved

me.undo

Posted on 2002-03-04
4
442 Views
Last Modified: 2011-09-20
I have a control on a form entitled Undo Changes. This control is disabled until this event is fired:

Private Sub Form_Dirty(Cancel As Integer)
    Me.cmdUndo.Enabled = True
End Sub

The cmd button executes the following code:
me.undo
After executing this code, the cmd button should be disabled once again.

Where do I put this code?
Me.cmdUndo.Enabled = True
0
Comment
Question by:Paullkha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 54

Expert Comment

by:nico5038
ID: 6839228
Why disabling this control?

I normally code an [Undo] button like:

If me.dirty then
   me.undo
endif

and have it always enabled.
The user will know when he "screw up" the form...

Nic;o)
0
 
LVL 2

Author Comment

by:Paullkha
ID: 6839394
True. But in most applications, the behavior is undo button disabled until one has changed the doc. If one hits undo, the doc is cleaned and the undo button is again disabled. Trying to mimick this behavior but can not see how.
0
 
LVL 1

Accepted Solution

by:
CareyMBilyeu earned 40 total points
ID: 6839449
but to answer your question:

The cmd button executes the following code:
me.undo
Me!cmdUndo.Enabled=False  

'***You might have to set focus back to the form and then
'to the control as well as move the focus to another
'control.


After executing this code, the cmd button should be disabled once again.

Where do I put this code?
Me.cmdUndo.Enabled = True
0
 
LVL 2

Author Comment

by:Paullkha
ID: 6839499
Focus?
damn, it works, didn't think I could do that.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question