A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Set Focus after Undo



 
 
Thread Tools Display Modes
  #1  
Old May 1st, 2009, 07:02 PM posted to microsoft.public.access
alex
external usenet poster
 
Posts: 581
Default Set Focus after Undo

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
  #2  
Old May 2nd, 2009, 03:56 AM posted to microsoft.public.access
Allen Browne
external usenet poster
 
Posts: 11,706
Default Set Focus after Undo

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.

"alex" wrote in message
...
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


  #3  
Old May 5th, 2009, 12:12 PM posted to microsoft.public.access
alex
external usenet poster
 
Posts: 581
Default Set Focus after Undo

On May 1, 10:56*pm, "Allen Browne" wrote:
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.

"alex" wrote in message

...



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- Hide quoted text -


- Show quoted text -


That worked well Allen, thanks for the help.
alex
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:22 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.