+ Reply to Thread
Results 1 to 4 of 4

Take action after entry in a textbox (or after tabbing out of/into it)

  1. #1
    Registered User
    Join Date
    06-02-2005
    Posts
    9

    Take action after entry in a textbox (or after tabbing out of/into it)

    Hi all,

    I have a userform with some text boxes, and I want one of them to be grayed out depending on the entry in the one before it. If the user types "FL" in the first box, I want the second to be disabled. The trouble is that I want it to check this after the entry in the first box is made and while the userform is still up.

    How do I make it happen after the entry is made? It would also work if I could make it happen upon tabbing out of the box or into another. Here's the code I'm trying:


    Private Sub txtFee_Change()
    'grays out the fee box if txtState = FL
    If txtState = "FL" Then
    txtFee.Enabled = False
    Else: txtFee.Enabled = True
    End If
    End Sub


    This code is fine and works for graying out, but only if the txtState = "FL" at initialization. I want it to work right when FL is entered.

    Thanks for your help!

  2. #2
    Registered User
    Join Date
    08-18-2004
    Posts
    97
    Hi,

    To acomplish what you need intead of


    Please Login or Register  to view this content.
    Try

    Private Sub txtFee_AfterUpdate()
    'grays out the fee box if txtState = FL
    If txtState = "FL" Then
    txtFee.Enabled = False
    Else: txtFee.Enabled = True
    End If
    End Sub

    In design mode double click the txtFee Text Box and insert the modified code.
    If it works invite us to Florida

    Success

    Jose Luis



    Quote Originally Posted by Lost!
    Hi all,

    I have a userform with some text boxes, and I want one of them to be grayed out depending on the entry in the one before it. If the user types "FL" in the first box, I want the second to be disabled. The trouble is that I want it to check this after the entry in the first box is made and while the userform is still up.

    How do I make it happen after the entry is made? It would also work if I could make it happen upon tabbing out of the box or into another. Here's the code I'm trying:


    Private Sub txtFee_Change()
    'grays out the fee box if txtState = FL
    If txtState = "FL" Then
    txtFee.Enabled = False
    Else: txtFee.Enabled = True
    End If
    End Sub


    This code is fine and works for graying out, but only if the txtState = "FL" at initialization. I want it to work right when FL is entered.

    Thanks for your help!

  3. #3
    Registered User
    Join Date
    06-02-2005
    Posts
    9
    That worked perfectly. Thanks!!

  4. #4
    Registered User
    Join Date
    08-18-2004
    Posts
    97
    Nice to hear that!!! Now just missing the Florida Vacation


    Carpe Diem!

    Jose Luis


    Quote Originally Posted by Lost!
    That worked perfectly. Thanks!!

+ 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