Solved

Displaying 2 columns once selected

Posted on 2011-02-25
9
200 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Turn off MS Access Default=0 for Numerics 6 26
ms access filter query with empty combobox 5 29
MS Access from Delphi 31 29
Switch 5 17
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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.

773 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