Set Focus after Undo

  • Thread starter Thread starter alex
  • Start date Start date
A

alex

Hello,

I have some code in the AfterUpdate event of textbox that uses DLookup
to check for a value in a table.

If the value is found, I provide the user the option to ignore the
duplicate or undo the entry of the textbox.

I use a simple me.Undo that wipes the data from the textbox, but I
cannot seem to set the focus back to the same text box (so they can
start over).

Am I doing something wrong? Should I not be using me.undo?

alex
 
If the focus should not leave the box, use the BeforeUpdate event of the
control instead of AfterUpdate. The focus won't leave if you include the
line:
Cancel = True

BeforeUpdate is less flexible for altering the value. Perhaps you could undo
the control, or just let the user change it
 
If the focus should not leave the box, use the BeforeUpdate event of the
control instead of AfterUpdate. The focus won't leave if you include the
line:
    Cancel = True

BeforeUpdate is less flexible for altering the value. Perhaps you could undo
the control, or just let the user change it

--
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.











- Show quoted text -

That worked well Allen, thanks for the help.
alex
 
Back
Top