Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding a ComboBox

Status
Not open for further replies.

ghacig

Technical User
Sep 24, 2004
60
US
Dear All

I have a main form that contains several subforms and command buttons. The command buttons open other forms. It is becoming busy and cluttered and I would like to clean it up. My idea is to create several unbound ComboBoxes and line them up in the Header, and on the AfterUpdate property write a code to open a specific form based on the selection. This works out well, but ComboBoxes don't look nice on the form. My idea is to have Toggle Buttons that activate the combo boxes (Like you have on some Windows Froms where Toggle buttons are lined up in the Header a[highlight #E9B96E][/highlight]nd when you click them, a drop down menu appears). The problem is that it is hard to hide the ComboBox and make it appear only when the Toggle Button is pressed. I tried to set the property of the ComboBox.Visible to False and then change it to True when the Toggle Button is Clicked. It sort of works, but the problem is you still have the Comb-Box with the arrow right there.

I know this sounds complicated, but I would appreciate any ideas.

Thanks.

 
It sounds like you are adding more controls making it more "busy and cluttered".

If you toggle the combo box to Visible = No, it shouldn't be there. I'm not sure how you would "still have the Comb-Box with the arrow right there."

Duane
Hook'D on Access
MS Access MVP
 
Hi

Thanks so much for your replay. By adding the combobox, I can remove several command buttons. Sorry if I was not clear. The code for the Toggle Button AfterUpdate is:
CmboBox.Visible = True
ComboBox.setfocus
ComboBox.Dropdown

The ComboBox will be visible and all options too, but, I would like to have the drop down without the empty box and arrow in the ComboBox. Say, like this webpage, if you highlight the Forums on top, you see a dropdown menu.
 
If it's a toggle button, you can set the visible to the value of the toggle button.

Code:
Private Sub ToggleButton_AfterUpdate()
    Me.ComboBox.Visible = Me.ToggleButton
    If Me.ComboBox.Visible = True Then
        Me.ComboBox.SetFocus
        Me.ComboBox.Dropdown
    End If
End Sub

Duane
Hook'D on Access
MS Access MVP
 
I guess you want a ListBox instead of a ComboBox ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks for the code Duane.
Yes, a ListBox looks better, but I have to put it in the Detail section, not the Header because it occupies more space. I tried it with a ListBox and it works well. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top