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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2010, how to pull text from combo box

Status
Not open for further replies.

dawnd3

Instructor
Jul 1, 2001
1,153
US
Hi all, I have a combo box that is used as the criteria to open a form.(form is filtered based on what event the user picks in the combo box before clicking open.) How do I put the TEXT from the combo box into a label in the form header??? (I want to be able to see clearly what even it is while working on the form.) I was able to get the ID of the selected even into a text box, but not the actual text into a text box or label. Thank you for your help on this.

Dawn

 
me.label = forms("formname").combobox.column(1)
 
the value of the combo is the bound column. Often you hide the first column by setting its width to 0 (id) and show the second which is text. The columns are 0 indexed.

me.combo.column(1) ' returns the second column which may be the visible column
me.combo 'returns the bound column normally the first column
me.combo.column(0) ' returns the first column

 
Thanks PWise! Where do I put that? In the label? In one of the form events?



 
Ok, another dumb question, how do I insert a label without any text into it? If I don't type in text the label disappears????

 
How are ya dawnd3 . . .
dawnd3 said:
[blue] ... [purple]how do I insert a label without any text into it?[/purple] If I don't type in text the label disappears????[/blue]
You've proven that you can't ... at least not the way you prescribe. What you do is as follows:
[ol][li]Insert the Label.[/li]
[li]Type a single character and hit enter (now you have the label!)[/li]
[li]Make sure the label has the focus ... call up the [blue]properties[/blue] window ... select the [blue]Format Tab[/blue] and delete whats in the [blue]Caption[/blue] property. Set the focus anywhere else and your done ...[/li][/ol]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Perfect! Thank you Ace! Good to "see" you again. :) Everyone else, i still cannot figure out the original question. I have tried all suggestions in various locations. I currently have Me.Label31 = [Forms]![MainMenu]![cboEvent].Column(1) in the On Load of the form and it says that it does not support this property or method when I open the form. I tried it on the On Open as well.

 
Also you can make this easier by using a textbox instead. Just set its property to Locked. Then you do not have to ensure it has focus and do not have to put in a default value.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top