Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhide Combo box (2000)

    Hi,
    Probably an age old question here, but I have a control(A) that once clicked I would like to grey out, then display a further set of previously invisible Comboboxes([img]/forums/images/smilies/cool.gif[/img] & controls©.
    They way I thought of doing it would be to place a checkbox(D) (invisible) on the form, which would be checked once by the On Click of (A). Then B & C would check to see if D was true or false then:

    If [nameofcheckbox]=True Then
    NameOfCommandButton.Visible = True
    End If

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Unhide Combo box (2000)

    You don't need the checkbox.
    In the on click event of TextboxA use :<pre>Me.ComboB.Visible = Not Me.ComboB.Visible
    Me.ControlC.Visible = Not Me.ControlC.Visible
    <font color=448800>'Following line only if you want to prevent modifying TextboxA when ComboB is visible</font color=448800>
    Me.TextboxA.Locked = Not Me.TextBoxA.Locked
    <font color=448800> 'Following line can be replaces by : If Me.ComboB.Visible = True Then</font color=448800>
    If Me.TextboxA.Locked = True Then
    Me.TextboxA.BackColor = 12632256
    Else
    Me.TextboxA.BackColor = 16777215
    End If</pre>

    Francois

  3. #3
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Unhide Combo box (2000)

    Thanks for that.
    It seems to be picking up an error on the following line:
    Me.CmdEstimateSent.Locked = Not Me.CmdEstimateSent. Locked , with the bold text being the error 'Compile Error. Method or data not found'
    I also presume that I should set the invisible controls/Comboboxes to Visible=No in the Format

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Unhide Combo box (2000)

    Francois' code locked/unlocked a text box. You can't lock a command button. If necessary, you can enable/disable it:

    Me.CmdEstimateSent.Enabled= Not Me.CmdEstimateSent.Enabled

    You can expand Francois' code to do other things in a similar fashion to Me.ComboB.Visible = Not Me.ComboB.Visible.

Posting Permissions

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