chacham
Member
- Local time
- Today, 15:13
- Joined
- Oct 26, 2020
- Messages
- 45
Just thought i'd share and perhaps even ask for comment. I am beginning to work on someone else's Access program and have a lot to learn.
Anyway, the request was to remove the label from a couple comboboxes and place default text in them instead. After some searching it seems this cannot be done easily because the comboboxes get their data from a query, limited to list, and have multiple columns of which the first is an id and not displayed. So, using one suggestion, i put a second combobox with the default text directly atop the first one, and in its MouseDown event, turned its visibility off, gave focus to the "real" combobox, and fired its DropDown event. Works like a charm.
To be specific: The new combobox gets the same Width, Height, Top, and Left values as the real one. ForeColor is set to #ABABAB, Row Source Type is Value List, and the Row Source and Default Value are set to the default text. The On Mouse Down Event is set to Event Procedure:
Anyway, the request was to remove the label from a couple comboboxes and place default text in them instead. After some searching it seems this cannot be done easily because the comboboxes get their data from a query, limited to list, and have multiple columns of which the first is an id and not displayed. So, using one suggestion, i put a second combobox with the default text directly atop the first one, and in its MouseDown event, turned its visibility off, gave focus to the "real" combobox, and fired its DropDown event. Works like a charm.
To be specific: The new combobox gets the same Width, Height, Top, and Left values as the real one. ForeColor is set to #ABABAB, Row Source Type is Value List, and the Row Source and Default Value are set to the default text. The On Mouse Down Event is set to Event Procedure:
Code:
Private Sub cmbNH_default_text_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Just acting as default text. Let's go away and pass that click on to the "real" control.
cmbNH.SetFocus
cmbNH_default_text.Visible = False
cmbNH.Dropdown
End Sub
Last edited: