Ask a questionAsk a question
 

AnswerExcel userform problem

  • Thursday, November 05, 2009 11:07 AMs7yzrs Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    hello everybody, I need to know whether it is possible (and how) to block textboxes of a userform if the value of a combobox is x,y,w,z

    thanks for any help

Answers

  • Thursday, November 05, 2009 8:03 PMJeff - www.SRSoft.usMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    if you want the textbox to be disabled based on another control then try setting the enabled property in an event related to the other control.

    in other words, if the textbox being enabled depends on the combobox selection then use the combobox events
    FREE DEVELOPER TOOLS, CODE & PROJECTS at www.srsoft.us Database Code Generator and Tutorial
    • Marked As Answer bys7yzrs Thursday, November 05, 2009 8:52 PM
    •  
  • Thursday, November 05, 2009 5:50 PMs7yzrs Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hello Jeff, thanks for the very quick reply. The code works but... not immediately. Here is what I did and what I get:

    in VB I selected the textbox I need to be disabled and this is the code I wrote:

    Private Sub GWeight_Change()
    If Me.ComboAirline.Text = "DL" Then
    Me.GWeight.Enabled = False
    End If

    End Sub

    The result is that I can still write at least 1 letter in the textbox before it is disabled (tab order of textbox is 4). am I doing something wrong?

    Thanks for you patience and help
    • Marked As Answer bys7yzrs Thursday, November 05, 2009 8:52 PM
    •  

All Replies