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 » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Left, LTrim, or what



 
 
Thread Tools Display Modes
  #1  
Old January 23rd, 2006, 03:53 AM posted to microsoft.public.access.queries
external usenet poster
 
Posts: n/a
Default Left, LTrim, or what

I have a field with Lastname, Firstname (ex: "Smith, John")

I want to extract the Last name and first initial (ex: "Smith, J).

What's the code?

Thanks in advance.

Jerry
  #2  
Old January 23rd, 2006, 03:59 AM posted to microsoft.public.access.queries
external usenet poster
 
Posts: n/a
Default Left, LTrim, or what

Hopefully your field values are consistent.

Feel free to open a module and search Help on Left, Mid, Instr. You should
be able to figure out the syntax. If not, come back with "a field" name.

--
Duane Hookom
MS Access MVP
--

"JWCrosby" wrote in message
...
I have a field with Lastname, Firstname (ex: "Smith, John")

I want to extract the Last name and first initial (ex: "Smith, J).

What's the code?

Thanks in advance.

Jerry



  #3  
Old January 23rd, 2006, 04:01 AM posted to microsoft.public.access.queries
external usenet poster
 
Posts: n/a
Default Left, LTrim, or what

Use:
- Instr() to locate the comma,
- Mid() to get the remainder of the field,
-Trim() to deal with the space.

So, assuming a field named FullName, the FirstName would be:
Trim(Mid([FullName], Instr([FullName], ",") + 1))

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"JWCrosby" wrote in message
...
I have a field with Lastname, Firstname (ex: "Smith, John")

I want to extract the Last name and first initial (ex: "Smith, J).

What's the code?

Thanks in advance.

Jerry



  #4  
Old January 23rd, 2006, 04:12 AM posted to microsoft.public.access.queries
external usenet poster
 
Posts: n/a
Default Left, LTrim, or what


"JWCrosby" wrote in message
...
I have a field with Lastname, Firstname (ex: "Smith, John")

I want to extract the Last name and first initial (ex: "Smith, J).

What's the code?

Thanks in advance.

Jerry


Perhaps:

Left([FullName], Instr([FullName], ",") + 2)

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.

  #5  
Old January 23rd, 2006, 04:23 AM posted to microsoft.public.access.queries
external usenet poster
 
Posts: n/a
Default Left, LTrim, or what

Yours did it, Randy. Thanks!

Jerry

"Randy Harris" wrote:


"JWCrosby" wrote in message
...
I have a field with Lastname, Firstname (ex: "Smith, John")

I want to extract the Last name and first initial (ex: "Smith, J).

What's the code?

Thanks in advance.

Jerry


Perhaps:

Left([FullName], Instr([FullName], ",") + 2)

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.


 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Relationship feature/bug/accident Peter Danes General Discussion 22 September 11th, 2005 11:15 PM
Relationship feature/bug/accident Peter Danes Using Forms 22 September 11th, 2005 11:15 PM
SaveAsText & LoadFromText Tom Collins General Discussion 9 February 25th, 2005 01:26 PM
Joining 2 Left Join Queries esi Running & Setting Up Queries 2 September 16th, 2004 08:16 PM
Left Join weird problem Roberto Fabbrica Running & Setting Up Queries 1 August 16th, 2004 12:08 PM


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


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