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

Combining Name Fields in Query

Status
Not open for further replies.

tyemm

Technical User
Feb 28, 2005
66
US
I have not yet been able to combine or concatenate name parts in a query!
I have Last, First and MI as fields in a table NAME that I inherited. I want to create a fourth field in the form Last First MI, with spaces between First and MI, if MI exists, and no space after First, if MI doesn't exist (and space between Last and First, of course). I need help combining in these two different situations: where MI exsits and where it doesn't!
 
The SQL to obtain the name would be like this.
Code:
SELECT Last & ", " & First & IIf( MI IS NOT NULL, " " & MI, "")
FROM MyTable
 
I knew it was that simple!
Thanks--
Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top