Re: SetFocus in Form Undo event

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance





"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?





.



Relevant Pages

  • Re: Authentication from Active Directory and Database based user d
    ... coding jsp struts I'm sure there was a tag you placed around a control ... If you configure IIS to only use Windows integrated authentication for your ... you'll only need to worry about authorization based on assigned roles. ... I'm writing a web system ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: IEBCOPY in z/OS R13 (was (re: z/OS 1.13 preview (was: Lines, Bars and ... mini-bars???))
    ... Then I could run SMP/E also without APF authorization, ... repair that program or restrict access to it. ... Additionally I'll note that we do allow unauthorized programs to perform ... sensitive operations under the control of a RACF authorization check. ...
    (bit.listserv.ibm-main)
  • Re: Cracks/Key Generators
    ... control, with what the user gets being merely an interface to ... instructions that ignore the result of the authorization test ... 'one-time pad' is. ... What is "The Ultimate Meme"? ...
    (comp.security.misc)
  • Re: SetFocus in Form Undo event
    ... How does a user cancel an order or carry out the undo - how many different ... Certain suppliers require authorization, but most do not. ... relevant control unless authorization is actually required. ...
    (microsoft.public.access.formscoding)
  • Re: OldValue not set
    ... OldValue only works with BOUND controls because the OldValue is actually the current value of the control's bound field ... If the control is unbound then there is no OldValue. ... Sub SomeControl_Enter ...
    (comp.databases.ms-access)