I am working with an ACCESS query that has a field called PR_EMP_NAME. This field contains an employee’s last name, first name and middle name. I need to separate this field into three separate fields. I have been able to separate the field into the last and middle names but can’t figure out how to get the first name which is in between the last and middle names. All names are separated by a space. I am using the following to obtain the Last and Middle names. Any ideas how I can get the first name? - LastName: Trim(Left([PR_EMP_NAME],InStr(1,[PR_EMP_NAME]," ")))
- MiddleName: Right([personnel]![PR_EMP_NAME],Len([personnel]![PR_EMP_NAME])-InStrRev([personnel]![PR_EMP_NAME]," "))
Try this: - FirstName: Trim(Mid([PR_EMP_NAME],InStr(1,[PR_EMP_NAME]," "),InStrRev([PR_EMP_NAME]," ")-InStr(1,[PR_EMP_NAME]," ")))
This will consider everything between the first space and the last space in the name to be the "middle" name. That should work as you've described your source data; if it doesn't then please post some examples for us to work with and we can modify the function a bit.
Hope that was helpful, and welcome to Bytes. :)
2 2593
Try this: - FirstName: Trim(Mid([PR_EMP_NAME],InStr(1,[PR_EMP_NAME]," "),InStrRev([PR_EMP_NAME]," ")-InStr(1,[PR_EMP_NAME]," ")))
This will consider everything between the first space and the last space in the name to be the "middle" name. That should work as you've described your source data; if it doesn't then please post some examples for us to work with and we can modify the function a bit.
Hope that was helpful, and welcome to Bytes. :)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: ND |
last post by:
I need to create a separate field from 4 fields, "street address", "city",
"State" and "zip code". For example,
Street address - 100 Forest Street
City - Seattle
State - WA
Zip - 05555
...
|
by: Tony |
last post by:
Hi,
I have an ID text field that is composed of two alphabetical letters
and the rest are numbers. This field is also a primary key. In this
same table, I want to separate this field into two...
|
by: Chuck Anderson |
last post by:
I'm pretty much a JavaScript novice. I'm good at learning by example
and changing those examples to suit my needs. That said ....
..... I have some select fields in a form I created for a...
|
by: Grex |
last post by:
I have a table with about 20 fields. There is a name field that is populated repeatedly with the same names over and over. Let's say 1000 records, and 25 names. Each name is in there 40 times.
I...
|
by: CollierC |
last post by:
I need to write a query that manipulates a name field from "firstname lastname" to "lastname, firstname". I have read multiple solutions to split firstname and lastname to separate fields,...
|
by: NeilIanBaker |
last post by:
Hello
I am trying to select the first name and surname from a name field where the name is in the form of;
eg. Mrs Marilyn Payne
Mrs Mary Swanton
Ms EM Lomas
Lt Col R...
|
by: adamjblakey |
last post by:
Hi,
I have a function here:
var AdminResponse = "";
function parseResponse(){
var nText = AdminResponse.getElementsByTagName('optionText');
|
by: MindBender77 |
last post by:
Hello Again All,
I have a memo field that is backslash delimited. I am attempting to break up this field into individual fields.
Ex (memo field). \John L. Doe\\StreetName RD\\City, Pa 11111
...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
| |