473,396 Members | 1,754 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Splitting one field in a table into two

matrekz42
Good afternoon Gurus,

I have a table in Access that has a name field listed as follows:

LASTNAME; FIRSTNAME

All in the same field, and I want to split the first name from the last into two individual columns, how would I go about this without using a splitter software?
Thank you in advance.
Oct 15 '07 #1
4 1264
nico5038
3,080 Expert 2GB
You can use a query for this, but the result's will only deal with 2 words in the field. Names like "John Paul II Rocky Sr" can't be handles this way.

Try:
Expand|Select|Wrap|Line Numbers
  1. select left([YourFieldname],instr([YourFieldname]," ")-1) as FirstWord, mid([YourFieldname],instr([YourFieldname]," ")+1) as LastWord, ...
  2.  
Having this working will allow you to change it into a maketable query to store the final results in a new table.

Nic;o)
Oct 15 '07 #2
missinglinq
3,532 Expert 2GB
There's a number of ways to do this. One would be to make a simple select query based on you table (if you don't already have one) and make these two calculated fields:

Expand|Select|Wrap|Line Numbers
  1. FirstName: Right(OriginalName, Len(OriginalName) - InStr(OriginalName, " "))
  2.  
and
Expand|Select|Wrap|Line Numbers
  1. LastName: Left(OriginalName, InStr(OriginalName, ";") - 1)
where OriginalName is the name of the field you start out with.

Then use the query behind your tables, reports, etc, and refer to the fields LastName and FirstName as you would any other field. This is dependent, as is all parsing, on the original data being entered in the exact format you indicated.

Welcome to TheScripts!

Linq ;0)>
Oct 15 '07 #3
missinglinq
3,532 Expert 2GB
And it's a tie at 4:29 between Nic;o) and ;0)>! But you missed the semicolon between the two names!

As my signature sez, There's always more than one way to skin a cat!
Oct 15 '07 #4
Thank you for all your help.
Oct 15 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Earl Anderson | last post by:
I have imported an Excel worksheet into A97/WinXPH which had the new employees names in one field ( in a Last Name,First Name configuration). I wanted to split that one field ( ) into two...
2
by: Gary Lynch | last post by:
I am looking for a simple solution to a recurrent problem with imported data in Access 97. The example below is a simplification of a problem with a much larger database. Let's say I start out...
4
by: bill_nirl | last post by:
Hi all, can anyone help. i have a spreasheet (set up by a looney) they have in the surname field, the surname then forename. What sort of code would i need to use to sort this out. It looks...
3
by: aaronvb | last post by:
Hi there, I'm currently trying to fix up a database that has had many different people work on it and therefore is confusing me no end. Currently i am trying to update a field, in the table ...
2
by: Izod | last post by:
I'm new, hope I describe my dilemma ok. I've got a large DB from the County. They have the "house Number" in the same field as the Street Name. It is always the 1st 4 characters followed by a...
4
by: The Facilitator | last post by:
Well, Outlook seems to be making my life more and more challenging. Categories are added in one field and are delimmited via comma. Have three questions on this one... The first is right now...
5
by: mctime | last post by:
Hello, I am attempting to split a raw data table into a new table that has split out a specific field in the raw data and created a new record for each split but I have come to an impasse due to...
8
by: rpeacock | last post by:
Hopefully this is an easy process, but it is giving me all kinds of troubles. I am working in MS SQL 2005. I need to take a field that has multiple objects (text) in there that is separated by...
1
by: Nevgar | last post by:
I am fairly new to php / MySQL and have a problem with a query and an insert. I have a database that maybe isn't the best design - it includes a field "Former Names" which is varchar 255. It...
15
by: Kasghost | last post by:
Rarely do I play with access so please keep it simple if possible. What I have are 2 tables. In table1 I have two fields, both are text. Field1 lists application names (Access, Excel, IE 7, ect)....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.