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 » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

First Names



 
 
Thread Tools Display Modes
  #1  
Old October 17th, 2009, 09:32 AM posted to microsoft.public.access.gettingstarted
Roger Bell
external usenet poster
 
Posts: 275
Default First Names

I have a text box on a report as follows:
=Trim([Titles] & " " & [Firstname] & " " & [Lastname])
The problem is that sometimes the Firstname field contains more than 1 name.
eg: John William
I would like to incorporate a function in the command above that will show
only the first name reference.
eg: John
Could someone please advise how I can do this?
Many thanks for your help.
  #2  
Old October 17th, 2009, 11:23 AM posted to microsoft.public.access.gettingstarted
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default First Names

One approach would be

=Trim([Titles] & " " & IIf(InStr([Firstname], " ") = 0, [Firstname],
Left([Firstname], InStr([[Firstname], " ") - 1)) & " " & [Lastname])


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Roger Bell" wrote in message
...
I have a text box on a report as follows:
=Trim([Titles] & " " & [Firstname] & " " & [Lastname])
The problem is that sometimes the Firstname field contains more than 1
name.
eg: John William
I would like to incorporate a function in the command above that will show
only the first name reference.
eg: John
Could someone please advise how I can do this?
Many thanks for your help.



  #3  
Old October 17th, 2009, 04:34 PM posted to microsoft.public.access.gettingstarted
Beetle
external usenet poster
 
Posts: 1,254
Default First Names

Assuming that there is always just a single space between
the two parts of the first name;

=Trim([Title] & " " & IIf(InStr([FirstName]," ")0,
Left([FirstName],InStr([FirstName]," ")-1),[FirstName])
& " " & [LastName])

(You'll have to correct for line wrap)

--
_________

Sean Bailey


"Roger Bell" wrote:

I have a text box on a report as follows:
=Trim([Titles] & " " & [Firstname] & " " & [Lastname])
The problem is that sometimes the Firstname field contains more than 1 name.
eg: John William
I would like to incorporate a function in the command above that will show
only the first name reference.
eg: John
Could someone please advise how I can do this?
Many thanks for your help.

  #4  
Old October 17th, 2009, 05:10 PM posted to microsoft.public.access.gettingstarted
Philip Herlihy[_2_]
external usenet poster
 
Posts: 64
Default First Names

Douglas J. Steele wrote:
One approach would be

=Trim([Titles] & " " & IIf(InStr([Firstname], " ") = 0, [Firstname],
Left([Firstname], InStr([[Firstname], " ") - 1)) & " " & [Lastname])




"Roger Bell" wrote in message
...
I have a text box on a report as follows:
=Trim([Titles] & " " & [Firstname] & " " & [Lastname])
The problem is that sometimes the Firstname field contains more than 1
name.
eg: John William
I would like to incorporate a function in the command above that

will show
only the first name reference.
eg: John
Could someone please advise how I can do this?
Many thanks for your help.



Like addresses, names just aren't "regular" enough! In this sort of
situation I've sometimes concluded that it's worth storing an extra
field "display name" and using that where appropriate.

Phil, London



 




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 05:54 AM.


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