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

Combo Box Issue 1

Status
Not open for further replies.

nag9127

Technical User
Mar 15, 2007
76
US
I am having a problem with combo box behavior. The combo box source is a query which has item number and description as the 2 columns. I have changed the order so that description sorted alphabetically appears in the first column with auto expand turned on. I have been able to accomplish all this, but I want the item number from the second column to fly into the combo box when the selection is made. I set the bound column to '2', but that didn't do it. This is an unbound combo box. But I'd like to know how to do this for bound and unbound combo boxes because there are many places I can apply this. Thanks for any help!!!
 
In the Combo Box property, Format. You need to set the Column Count to 2 and the Column Widths to something like 1.0cm; 3.0cm.

 
You normally use 1 bound column (bound to a recordsource that is). But you can have more columns showing to the user (column count). How (wide) they are displayed, you can describe in the Column Withs. How wide the whole combox is (all the columns) you put in List With...

Pampers [afro]
Keeping it simple can be complicated
 
How are ya nag9127 . . .

The data that gets entered/displayed in the [blue]Textbox portion[/blue] of a combobox is that which comes from the first non-zero column width in the [blue]Column Widths[/blue] property. Trying to display data from an alternate column under the above conditions will cause a [purple]NotInList[/purple] error!

What you can do is use the combo as a lookup and store the [blue]item number[/blue] found in an alternate textbox.

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
TheAceMan1....

Are you refering to using the "=Column()" technique in the textbox control source property to pull the data from the combo box, or are you suggesting some other method?
 
nag9127 . . .

In the [blue]AfterUpdate[/blue] event of the combo . . .
Code:
[blue]   Me![purple][b][i]TextboxName[/i][/b][/purple] = Me![purple][b][i]ComboboxName[/i][/b][/purple].Column(?)[/blue]
. . . shound work just fine.

Note: The bound column is the column that gets stored (if combo is bound to a field) and along with the first non-zero displayed column is [blue]the reason why you can store one field while displaying another . . .[/blue]

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
You can store one value while displaying another! That is what I do not want. I have the same sitation.

I have a table with code and the full text. It'd easier to enter and seach codes so the drop down list in the combobox has 2 columns -

The bound column is 2 - the whole text, not the code.

But the form displays the code.

The underlying table stores the whold name.

How can the whole name be displayed and stored?
 
LOKIDOG . . .

Set the [blue]Bound Column[/blue] property the same as the first non-zero width column in the [blue]Column Widths[/blue] property . . .

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top