+ Reply to Thread
Results 1 to 5 of 5

txtbox focus

  1. #1
    Registered User
    Join Date
    01-13-2007
    Posts
    71

    Exclamation txtbox focus

    Hi all!

    Well im trying to make the users of a form obliged to type into a textbox.

    i wrote a code in a exit event of the textbox like this:

    Private Sub txtbox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)

    if txtbox1.value = "" then

    txtbox1.setfocus

    end if

    End Sub

    but when i hit "TAB" it does not "setfocus" on the txtbox.

    What am i doing wrong? how do i make this??

    any help appreciated!

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Hello. Change:
    Please Login or Register  to view this content.
    to:
    Please Login or Register  to view this content.
    HTH

    Jason

  3. #3
    Registered User
    Join Date
    01-19-2007
    Posts
    24

    Try this -

    Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = 9 Then
    MsgBox "Tab"
    TextBox1.SetFocus
    End If

    End Sub

  4. #4
    Registered User
    Join Date
    01-13-2007
    Posts
    71

    Thumbs up

    Jason,

    tyvm it worked just fine!!!

    thx you all for the tips!

    MP

  5. #5
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    No problem, MP.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1