Display label within a Combo Box

sparkyrose

Registered User.
Local time
Today, 08:30
Joined
Sep 12, 2007
Messages
31
Hi all,

I'm curious whether it's possible to display the label for a combo within the box itself, i.e. it would say something like "Enter Name" until the user clicked on it and opened the dropdown?

I found this which is really old and I couldn't get it to work.

http://www.access-programmers.co.uk/forums/showthread.php?t=17706

Any thoughts?

Thanks in advance.
 
How I usually do it is to put a transparent text box with transparent borders over the combo and in the click event of the text box

Code:
Me.ComboNameHere.SetFocus
Me.ComboNameHere.DropDown
Me.TextBoxName.Visible = False
 
Thanks that worked great.

For the benefit of others, I had to make an addition because navigating to a record where the combo value had been selected made them both show up.

I added the following to the OnCurrent event of the form and now the text box only shows if the underlying combo is null.

Code:
Private Sub Form_Current()

If IsNull(ComboName) Then
    TextBox.Visible = True
    
    Else
    
    TextBox.Visible = False
    End If
    
End Sub

Thanks so much!
 

Users who are viewing this thread

Back
Top Bottom