LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Form, SetFocus and AfterUpdate issue

Hi all,
Small piece of validation on text box. If it's not 8 characters, clear the
text box and place the insertion point in the same text box.
The following in placed in the After_Update event:

Dim PN As String

PN = txtpolicynumber.Text

If Len(Policynumber) < 8 Then
Msgbox "Invalid Entry. Must be 8 digits long", vbOKOnly + vbCritical,
"Data Validation"
txtpolicynumber.Text = ""
txtpolicynumber.SetFocus
End If

This works *ok* in a command button, but *not* in the text box's
after_update event. It places the cursor in the next text box. I can only
assume that it is placing the focus in the required text box, but it is not
cancelling the tab event, and still moving to the next object.

Any ideas on how to cancel the tab? :-s

TIA,

Piers


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange issue freezing parent form when unloading a child form Stefano Gatto Excel Programming 1 November 11th 05 04:42 PM
setfocus on user form inquirer Excel Programming 7 May 17th 05 12:28 AM
AfterUpdate bforster1[_26_] Excel Programming 1 November 6th 04 07:16 PM
setfocus on multipage tab form gives error message Cheryl Excel Programming 3 July 28th 04 03:07 PM
SetFocus in user form John Tjia Excel Programming 6 February 2nd 04 03:05 PM


All times are GMT +1. The time now is 06:42 AM.

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

About Us

"It's about Microsoft Excel"