Set Focus after Undo

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
 
A

Allen Browne

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
 
A

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

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

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

Similar Threads

Suppress MsgBox 7
Changing the focus 2
On Exit Event 2
if duplicate goto record 3
Set Focus 2
Can't undo a form's TextBox entry that has a validation rule 7
Textbox After Update Event 6
Error 2185 2

Top