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!

question on merging columns 1

Status
Not open for further replies.

hydochick

Technical User
May 1, 2007
1
NL
Hello,

I'm actually still a beginner with MS Access and I have three columns: one with the titles like Mr., Mrs., Mr. & Mrs., H.E. Mr., etc. and the two others are initals and last names.

Is there a way I can combine these three so that I don't end up with some having lots of spaces in between compared to others??

I would appreciate it if someone could tell me how to do this.

Thank you very much.
 
You want to concatenate the values together. The operator for this is the amperstand (&).

Change your control source to something like...

= Trim(Trim([Title] & " " & [FirstName]) & " " & [LastName])

The other thing to note is if the control's name was a field name you need to change it to something else like txtFullName so you do not end up with a circular reference that will cause an error (probably one that really does not help you find the problem).

The trim function removes whitespace (tabs and spaces). The example above puts a space between each of the three fields and trim takes them out if any of the fields are empty.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top