+ Reply to Thread
Results 1 to 10 of 10

Hide combo 3 based on combo1

  1. #1
    Registered User
    Join Date
    08-05-2005
    Posts
    59

    Hide combo 3 based on combo1

    Hi guys,

    Two specific combo boxes, cmbhardwarecat and cmbprintercat.
    If cmbhardwarecat = printer then show cmbprintercat (including lable: lblprintercat) otherwise hide.

    trying to work out why this isn't working:

    Please Login or Register  to view this content.
    Any ideas would be much apprciated.

  2. #2
    Ardus Petus
    Guest

    Re: Hide combo 3 based on combo1

    Hi Harps,

    '-----
    Private Sub cmbprintercat_Change()
    Dim bVisible As Boolean
    bVisible = cmbhardwarecat = "Printer"
    cmbprintercat = bVisible
    lblprintercat = bVisible
    End Sub
    '-----

    HTH
    --
    AP

    "harpscardiff" <harpscardiff.27nbhb_1147355410.2873@excelforum-nospam.com> a
    écrit dans le message de news:
    harpscardiff.27nbhb_1147355410.2873@...rum-nospam.com...
    >
    > Hi guys,
    >
    > Two specific combo boxes, cmbhardwarecat and cmbprintercat.
    > If cmbhardwarecat = printer then show cmbprintercat (including lable:
    > lblprintercat) otherwise hide.
    >
    > trying to work out why this isn't working:
    >
    >
    > Code:
    > --------------------
    > Private Sub cmbprintercat_Change()
    > If Not cmbHardwarecat.Value = "Printer" Then
    > cmbprintercat.Visible = False
    > lblprintercat.Visible = False
    >
    > Else
    >
    > If cmbHardwarecat.Value = "Printer" Then
    > cmbprintercat.Visible = True
    > lblprintercat.Visible = True
    >
    > End If
    > End If
    > End Sub
    >
    > --------------------
    >
    >
    > Any ideas would be much apprciated.
    >
    >
    > --
    > harpscardiff
    > ------------------------------------------------------------------------
    > harpscardiff's Profile:
    > http://www.excelforum.com/member.php...o&userid=25960
    > View this thread: http://www.excelforum.com/showthread...hreadid=541063
    >




  3. #3
    Ivan Raiminius
    Guest

    Re: Hide combo 3 based on combo1

    Hi,

    try to set breakpoint at the first If and when the code stops after
    changing "cmbprintercat", check the value of cmbHardwarecat in
    immediate window. Maybe it is "printer" or "PRINTER" (which doesn't
    match with "Printer"). You may use UCASE to convert both values to the
    same case.

    Also maybe that boundcolumn for cmbHardwarecat contains different value
    then "printer", then set appropriate column to be boundcolumn.

    Regards,
    Ivan


  4. #4
    Ivan Raiminius
    Guest

    Re: Hide combo 3 based on combo1

    Hi,

    try to set breakpoint at the first If and when the code stops after
    changing "cmbprintercat", check the value of cmbHardwarecat in
    immediate window. Maybe it is "printer" or "PRINTER" (which doesn't
    match with "Printer"). You may use UCASE to convert both values to the
    same case.

    Also maybe that boundcolumn for cmbHardwarecat contains different value
    then "printer", then set appropriate column to be boundcolumn.

    Regards,
    Ivan


  5. #5
    Ivan Raiminius
    Guest

    Re: Hide combo 3 based on combo1

    Hi,

    try to set breakpoint at the first If and when the code stops after
    changing "cmbprintercat", check the value of cmbHardwarecat in
    immediate window. Maybe it is "printer" or "PRINTER" (which doesn't
    match with "Printer"). You may use UCASE to convert both values to the
    same case.

    Also maybe that boundcolumn for cmbHardwarecat contains different value
    then "printer", then set appropriate column to be boundcolumn.

    Regards,
    Ivan


  6. #6
    Registered User
    Join Date
    08-05-2005
    Posts
    59
    Thanks for the replys,

    Ivan, Check values again, set them to lowercase.
    Ardus, couldn't get your method to work.

    Do I need to set cmbprintercat Visible = False via the properites?

  7. #7
    Ivan Raiminius
    Guest

    Re: Hide combo 3 based on combo1

    Hi,

    this should work:
    Private Sub cmbprintercat_Change()
    dim bolHardwarecatVisible as boolean
    bolHardwarecatVisible = ucase(cmbHardwarecat.Value) =
    ucase("Printer")
    cmbprintercat.Visible = bolHardwarecatVisible
    lblprintercat.Visible = bolHardwarecatVisible
    End Sub

    Basically the same code as Ardus gave you.

    If you want cmbprintercat to be invisible when you show the userform,
    you can set it in properties of the control or programmaticaly before
    you show the userform to the user.

    with userform1
    ..cmbprintercat.visible=false
    ..show
    end with

    Regards,
    Ivan


  8. #8
    Registered User
    Join Date
    08-05-2005
    Posts
    59
    Thanks again, but still not luck.

    Just to make certain cmbprintercat is manually set to visible = false
    Hardwarecat to visible. Once Printer is selected from the dropdown list, cmbprintercat should become visible, which more options.

    So the code below should be attached to the invisible combo - cmbprintercat?

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    08-05-2005
    Posts
    59

    Talking

    I've cracked it - simple mistake!!

    Used:
    Please Login or Register  to view this content.
    But applied it to the cmbHardwarecat - so:

    Please Login or Register  to view this content.
    cheers guys!!

  10. #10
    Registered User
    Join Date
    08-05-2005
    Posts
    59

    Talking

    I've cracked it - simple mistake!!

    Used:
    Please Login or Register  to view this content.
    But applied it to the cmbHardwarecat - so:

    Please Login or Register  to view this content.
    cheers guys!!

+ 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