Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Navigating in Userform

Status
Not open for further replies.

lpekerman

Technical User
Dec 22, 2005
2
IL
Hello;

I have a userform with many fields.
Some of them have controls; example if Trade Date is entered as TODAY, not 12/22/05 then a message appears.

What I want to do is: the user enters the info with an error, tabs, the message shows up and then the curser goes back to the field that was entered;
I tried "afterupdate" and "setfocus" that did not work

thanks
 
Try 'Exit' event with 'Cancel' parameter.

combo
 
With a TextBox control, this will stop the user exiting the control if the wrong value is entered.
It should give you the idea.


Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox1.Value < 50 Then
Cancel = True
Else
'Any other Code you like
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top