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

concatenate fields for a combo box?

Status
Not open for further replies.

mpspillers

Programmer
May 2, 2002
8
0
0
US
Hi, folks -

I'm building a database that tracks visitors to a clinic. Three of the fields in the [clients] table are:

[client1stname]
[clientlastname]
[clientphone]

In one of my forms I want the user to be able to pull down a combo box that concatenates these three items to use as the rowsource of the combo box:

ex: "Smith, John (555) 222-3333"

Right now I'm using a 3-column combo box that shows all three fields when you pull it down. But once the user picks one, only the 1st column's data appears in the control.

How can I combine these 3 fields to create a new one so that this form's control can contain all three items merged together and can then be used in future queries/reports, etc?

Thanks for your help!
 
How about this :-

[clientlastname] & "," & [client1stname]
& " " & [clientphone]

You'll have to keep you bound column as a un-viewable column if this combo box is to a record search. Change the format properties of the combo box to show 2 columns which would look something like (0cm;3.5cm)

Steady ...
 
Two points: You can write this exact same formula into the underlying query. This is very handy when it will be used in more than one object and/or the requestor changes what information they want in it.

2nd, I've found that Access will return "error" on a correctly written concatenation formula. It is best to (1) start from scratch and (2) close and re-open the db if you think it is right but it isn't working
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top