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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
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 |