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

Combo Box Easy Question

Status
Not open for further replies.

freefour

MIS
Joined
Aug 26, 2004
Messages
33
Location
US
Hey all,

I have a combo box that selects several differnt fields. When one is selected, it only shows the data from the first field in the box. Is there a way to show all the data after selecting, as it does when the box drops down?

Thanks!
 
eeek... let me reword this.

I have a combobox that displays 3 different fields from a select statement when you click on the down-arrow to select an option. However, when one is selected, the box only shows the first field. Is there a way to show all the data after selected (as it does when it is dropped down)?


Combobox dropped down:
-----------------------------------------
| |\/|
-----------------------------------------
| 1 Smith Bob |
| 2 Doe John |
----------------------------------------

then when you click on "2 Doe John" it says:

-----------------------------------------
| 2 |\/|
-----------------------------------------

when I want it to say:

-----------------------------------------
| 2 Doe John |\/|
-----------------------------------------

Any ideas? thanks!
 
A combo box always displays the first column that is visible. Since you already have a multiple column combobox, do this

Insert a field as the first field in the source and make it:

[fieldwithnumber] & " " & [fieldname] & " " & [fieldwithlast]

then adjust your column count, make sure you adjust your bound column, and set the column widths to 0";whatever;whatever;whatever

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
Network Admin/Access Programmer
 
I personally prefer to use the combo box to display the first visible field. Instead, I will use the column properties of the combo box and unbound text boxes...

Consider the following...

SELECT ContactID, ContactLN, ContactFN from tblContact

ContactID column width is set to 0" so...
- when selecting from the combo box, the end user see LastName, FirstName
- after the selection is finished, the end user sees only the ContactLN or LastName in the combo box.

Using the MasterMage's solution, you can combine the ContactLN and ContactFN to produce
Aardvark, John
Boops, Betty

My preferred approach is to use the AfterUpdate event procedure...

If Nz(Me.cmbFindContact, 0) > 0 Then
Me.UnboundTextBox = Me.cmbFindContact.Column(2)
End If

Which result in the combo box displaying the last name and the unbound text box, called UnboundTextBox, displaying the first name.
 
How are ya freefour . . . . .

[blue]mstrmage1768[/blue] is right. You'll have concatenate first/last names into one field. Here's an sample SQL to return minimum fields. No changes necessary to bound & sorted lastname/firstname:
Code:
[blue]SELECT tblNames.NameID, [LastName] & " " & [FirstName] AS FullName
FROM tblNames
ORDER BY tblNames.LastName, tblNames.FirstName;[/blue]

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

Part and Inventory Search

Sponsor

Back
Top