Solved

Displaying 2 columns once selected

Posted on 2011-02-25
9
189 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
 
LVL 119

Expert Comment

by:Rey Obrero
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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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 119

Expert Comment

by:Rey Obrero
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server views 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 Microsoft Access…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now