Solved

Displaying 2 columns once selected

Posted on 2011-02-25
9
207 Views
Last Modified: 2012-06-27
Is it possible to display 2 columns when an item is selected?  

Right now, when you select from the list, only the last name will display at the top (not last | first - as the list itself does) - see screenshot.
ee-dropdown.jpg
0
Comment
Question by:gcgcit
  • 4
  • 3
  • 2
9 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34983167
No, not in the combobox.

You can do this with two textboxes with the controlsources set to the respective columns of the combobox:
cboName.Column(1)
cboName.Column(2)
Here the PK is the first Field which is Column(0)
LastName is the second column (cboName.Column(1))
FirstName is the third column (cboName.Column(2))
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 34983186
Or simply make the rowsource for the combobox a query the combines the First and Last Names:

Select NameID, LastName & ", " & FirstName AS FullName From YourTable

JeffCoachman
0
 

Author Comment

by:gcgcit
ID: 34983260
Do you have a sample database of this boag2000? I'm not quite clear on how to do this from above.
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34983350
the trick here is to superimposed an unbound textbox over the combo.

in the afterupdate event of the combo box, place this codes

Me.txtUnbound.SetFocus
Me.txtUnbound.Value = Me.cboName.Column(0) & " -  " & Me.cboName.Column(1)
0
 

Author Comment

by:gcgcit
ID: 34983364
so your interface will show a textbox that is "uneditable" and the combobox fills it?
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34983488
Well I don't know the specific or your Data.

Remember that your question here requires that you have a basic understanding of how to set these properties...
Besides it is not clear what the combobox is doing after the Name is selected.

Give it a try on your own first before you decide that you can't do it..
Open the properties of the combobox and try building the SQL I posted.
Set the Rowsource as something like I posted above.
Then set the ColumnCount to: 2
Set the ColumnWidths to : 0,1

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34983553
see this sample
Database41.mdb
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34983646
<so your interface will show a textbox that is "uneditable" and the combobox fills it?>

Yes.
0
 

Author Closing Comment

by:gcgcit
ID: 34997438
Changed the query

Name: [tblPeople].[txtLastName] & ", " & [tblPeople].[txtFirstName] - changed column count from 3 to 2. Voila.  Idea from boag2000 came first and was what intiated this change (slight modification to what expert suggested).
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question