A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Firstname plus Middlename??

Thread Tools Display Modes
Old June 4th, 2010, 07:02 PM posted to microsoft.public.access.reports
David W. Fenton
external usenet poster
Posts: 3,373
Default Firstname plus Middlename??

John Spencer wrote in

You have made an error in your expression.

" " & MiddleName will always return at least a space.
The plus sign will see the space and return it.

If you wanted to be safe you could use
[surname] & ", " & [firstname] & (" " + [middlename])

Although you could still end up with extra spaces if firstName and
middlename are null you would end up with
Spencer, and a space. "Spencer, "

This solves all the possibilities:

Mid(("12"+[LastName]) & (", "+(Trim([FirstName]
& (" "+[MiddleName])))),3)

David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

All times are GMT +1. The time now is 01:36 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright 2004-2018 OfficeFrustration.
The comments are property of their posters.