Results 1 to 2 of 2
  1. #1
    New Lounger Bigshrimp60's Avatar
    Join Date
    Mar 2011
    Posts
    22
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Code to add additional info after an item in a combo box has been selected.

    Hello,
    I have created a template with a userform that has a combo box with 3 items listed in it:
    member,
    non member.
    applicant.

    If the users choose "non member," or "applicant," items, that text is inserted into the document and that's the end of that. If they choose the "member" item, then I want the user to be able to add a member number like the example below.

    member, no.11111.
    non member.
    applicant.

    I will add a text box for the additional member no. to be entered, but I don't know how to make it work. All help will be appreciated. Thanks.

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts
    Here's one way to do it:

    Code:
    Private Sub cboMemberStatus_Change()
       Select Case cboMemberStatus.Text
          Case "Member"
             lblMemberNo.Enabled = True
             txtMemberNo.Enabled = True
          Case Else
             lblMemberNo.Enabled = False
             txtMemberNo.Enabled = False
             txtMemberNo.Text = ""
          End Select
    End Sub
    - the label could have a message like "Enter member number below:".
    You could also toggle the visibility of the label and textbox if you prefer.

    Gary

Posting Permissions

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