Re: SetFocus in Form Undo event
- From: Jerry Schwartz <JerrySchwartz@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 26 Jan 2009 07:58:03 -0800
"Jeanette Cunningham" wrote:
Hi Jerry,
when the user undoes their changes, the bound controls will be reset back to
their OldValue.
That is precisely what I want.
Perhaps you can check the value of one control (not sure which control is
best for this), if it's value after undo is the same as its OldValue, then
use that to hide the order control/button instead of trying to set focus.
In what event would I do that?
Unfortunately, I don't think this would help in any case. Here's a little
more explanation of what I want to do:
The user brings up an order, and it might or might not require
authorization. If the order requires authorization, then I want to display
the "Authorize" button and hide the "Order" button. If the order has already
been authorized, then I want to display the "Order" button but not the
"Authorize" button.
This all works fine, except in one corner case:
If the user authorizes the order, but then cancels the screen (without
having previously updated the underlying data), the states of the two buttons
do not return to their original values. This means the user no longer has the
ability to authorize the order without navigating to another record and then
back.
That's why I need to fiddle with the buttons when the form is cancelled. I
can't think of any other event that would do it.
As it happens, there are no bound controls that I can guarantee would have
changed, although I could make a new one and hide it somewhere. I think I'd
still have the same problem, though, because there isn't any event that gets
triggered after an Undo; so I don't see any place where I can check the value
of any control.
.
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
"Jerry Schwartz" <JerrySchwartz@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A865063B-89A6-434A-A4D8-0C4C66380130@xxxxxxxxxxxxxxxx
To make a long story short, I want to flip the state of a control when the
user undoes their changes. I can't do this if the control has the focus,
so I
need to move the focus to some other control first. My code looks
something
like this:
Private Sub Form_Undo(Cancel As Integer)
' If the associated publisher record requires authorization,
' we show the "Authorize order" button and hide the "Order sheet"
button.
Cancel = False
Me.SomewhereElse.SetFocus
Me.MyControl.Visible = False
Me.MyControl.Enabled = False
End Sub
It appears, however, that you cannot use the SetFocus method on any
control
during the Form Undo event.
Any suggestions?
- Follow-Ups:
- Re: SetFocus in Form Undo event
- From: Jeanette Cunningham
- Re: SetFocus in Form Undo event
- References:
- SetFocus in Form Undo event
- From: Jerry Schwartz
- Re: SetFocus in Form Undo event
- From: Jeanette Cunningham
- SetFocus in Form Undo event
- Prev by Date: Re: Error checking
- Next by Date: Re: Need form to display related record not just add new
- Previous by thread: Re: SetFocus in Form Undo event
- Next by thread: Re: SetFocus in Form Undo event
- Index(es):
Relevant Pages
|