473,425 Members | 1,788 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

Display full name in combo box

hey, guys,

I have a simple question --- simple only for you. I created a combo box
called "pick up a name". And the underlying table has lastname and
firstname columns. The full name can be showed in the pull down menu
because in the raw source I use something like"select xx.last_na,
selctxx.first_na from xx" but after click on the pull down menu, only
the last name showed in the box instead of full name. How to show the
full name in the box? I need that value to select another form. Thanks
a lot.

Mindy

Dec 8 '05 #1
4 5615
You can concatenate the 2 fields into one.

This example shows Surname first:
SELECT ClientID, Surname & ", " + Firstname AS FullName
FROM tblClient ORDER BY Surname, Firstname;

This one shows Firstname first:
SELECT ClientID, FirstName + " " & Surname AS FullName
FROM tblClient ORDER BY Firstname, Surname;

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mindy" <ma************@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...

I have a simple question --- simple only for you. I created a combo box
called "pick up a name". And the underlying table has lastname and
firstname columns. The full name can be showed in the pull down menu
because in the raw source I use something like"select xx.last_na,
selctxx.first_na from xx" but after click on the pull down menu, only
the last name showed in the box instead of full name. How to show the
full name in the box? I need that value to select another form. Thanks
a lot.

Mindy

Dec 8 '05 #2
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in
news:43***********************@per-qv1-newsreader-01.iinet.net.au:
You can concatenate the 2 fields into one.

This example shows Surname first:
SELECT ClientID, Surname & ", " + Firstname AS FullName
FROM tblClient ORDER BY Surname, Firstname;


This one will display ", Firstname" when there is no Surname.

I use the clever Mid() trick that, I believe, Trevor Best suggested:

Mid(("12"+Surname) & (", "+Firstname), 3)

that works in all cases.

For the other order, I just use Trim(Firstname & " " & Surname), but
your example is more efficient, as it doesn't need to call Trim().

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Dec 8 '05 #3
Thanks

Dec 9 '05 #4
Thanks

Dec 9 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Marc | last post by:
I'm back in the Access development mode and seem to have forgotten how to do 2 things that should be simple. I have a database with a table of contacts, companies and activities. The idea is that...
2
by: Dave N | last post by:
I have a combo box that displays the names of all the users in my "Users" table. I set the RowSource to a Query from the "User" and "Project" tables. I can select any name from the list and that...
3
by: Paul | last post by:
I have some option boxes and combo boxes that looks up values on a separate table (i.e. campus table with campusID & campus name fields) When I choose a selection from the combo box, it puts the...
1
by: Rich | last post by:
I have a form with a combo box on it. The combo box's source is a access lookup table with two columns, EmployeeName & EmployeeNumber. I want to display the EmployeeName from the dropdown but...
3
by: Gopal Krish | last post by:
I need to display uniqueidentifier (GUID) from a table in SQL Server into a ASP.NET Web Page (Combo box). I'm using C#. When I tried to display GUIDs in a combo box I get "System.Byte" for all...
6
by: Harshil | last post by:
I am developing an application in vb.net and oracle as my database. my goal is to display the county names (display member) to the user while store county id (value member) in the combo box. when I...
1
by: Jimmy Stewart | last post by:
Is there a way to set up a combo box so that when the user clicks the arrow, the list is populated with info from a specific field from a table but once they select an option, data from another...
2
by: gopal | last post by:
Hi, i tried to display only the file names like "document1.doc", document2.doc and so on in the combo list But i am unable to do so in the file name combo box in SAveFileDialog. Any one know...
4
by: rszebras | last post by:
I inherited a database (as a novice at Access) and need to modify it to make it more efficient, i.e., the assignment form needs to autopopulate with the client's name, address, phone number, etc.,...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.