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: 27
Default Having problems with textbox setfocus

Hello all,
Below is some code that I have been working on. what I am attempting to
accomplish was to ensure that an entry was made in this textbox and
that the entry was numeric. If it was not I am showing a messagebox and
attempting to reselect all the text in that same text box so that the
user could re-enter text. The problem is that it will not go back to
the same textbox. Instead focus continues to the next textbox.
Am I doing something wrong? Is there another setting that I am not
aware of?
Any suggestions would be appreciated.


Private Sub txttradekm_Exit(ByVal Cancel As msforms.ReturnBoolean)
Dim txttraqdekm As TextBox
With frmEntry
If Not Len(txtTradekm.Text) 0 Or Not IsNumeric(txtTradekm.Text) _
Or Not Val(txtTradekm.Value) 0 Then
MsgBox "Entry must be numeric and greater than zero",
vbInformation, "Invalid Entry"
txtTradekm.Text = ""
txtTradekm.SetFocus
txtTradekm.SelStart = 0
txtTradekm.SelLength = Len(txtTradekm.Text)
End If
End With
End Sub

Thanks Terry

 
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
setfocus in textbox on multipage Martin Excel Programming 5 January 6th 06 04:20 AM
textbox setfocus and select current contents rcmodelr Excel Programming 3 August 15th 05 02:05 PM
TextBox SetFocus Problem Tom Ogilvy Excel Programming 1 September 12th 03 01:27 PM
TextBox.SetFocus steve Excel Programming 4 July 16th 03 07:40 PM


All times are GMT +1. The time now is 08:50 AM.

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

About Us

"It's about Microsoft Excel"