Haven't seen this question yet.
I have a field that has "LastName,FirstName". I want to split that field
into two, based on the comma. Size of LastName is obviously different in
each record, so Left() won't work. Any ideas?
thanks in advance,
jlm 6 7827
Use the InStr function to find the comma:
MyLastName = Left([NameField],Instr([NameField],",")-1))
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications re******@pcdatasheet.com www.pcdatasheet.com
"JLM" <je**********@colostate.edu> wrote in message
news:40******@news.ColoState.EDU... Haven't seen this question yet.
I have a field that has "LastName,FirstName". I want to split that field into two, based on the comma. Size of LastName is obviously different in each record, so Left() won't work. Any ideas?
thanks in advance, jlm
Use x = Instr(myfield,",") to find the comma position.
Then use Left(myfield, x-1) to get the firstname
and Mid(myfield, x+1 ,len(myfield)) to get the second bit.
Peter Russell
JLM previously wrote: Haven't seen this question yet.
I have a field that has "LastName,FirstName". I want to split that field into two, based on the comma. Size of LastName is obviously different in each record, so Left() won't work. Any ideas?
thanks in advance, jlm
Thanks, this helps a lot. However, this works only for the left side of the
comma. I've messed with it and can't find the answer to get the right side
of the comma (less a single space).
jlm
"PC Datasheet" <sp**@nospam.spam> wrote in message
news:ML*******************@newsread1.news.atl.eart hlink.net... Use the InStr function to find the comma:
MyLastName = Left([NameField],Instr([NameField],",")-1))
-- PC Datasheet Your Resource For Help With Access, Excel And Word Applications re******@pcdatasheet.com www.pcdatasheet.com
"JLM" <je**********@colostate.edu> wrote in message news:40******@news.ColoState.EDU... Haven't seen this question yet.
I have a field that has "LastName,FirstName". I want to split that
field into two, based on the comma. Size of LastName is obviously different
in each record, so Left() won't work. Any ideas?
thanks in advance, jlm
On Mon, 23 Feb 2004 08:01:43 -0700, JLM wrote: Haven't seen this question yet.
I have a field that has "LastName,FirstName". I want to split that field into two, based on the comma. Size of LastName is obviously different in each record, so Left() won't work. Any ideas?
thanks in advance, jlm
Without a space after the comma?
LastName= Left([FullName],InStr([FullName],",")-1)
FirstName:Mid([FullName],InStr([FullName],",")+1)
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Peter's Mid function will do it for you. I just noticed that what I sent you
should have said MyFirstname instead of MyLastName. Here's Peter's Mid function
for the last name:
MyLastName = Mid([NameField], Instr([NameField],",")+1 ,Len([NameField]))
Steve
PC Datasheet
"JLM" <je**********@colostate.edu> wrote in message
news:40******@news.ColoState.EDU... Thanks, this helps a lot. However, this works only for the left side of the comma. I've messed with it and can't find the answer to get the right side of the comma (less a single space).
jlm
"PC Datasheet" <sp**@nospam.spam> wrote in message news:ML*******************@newsread1.news.atl.eart hlink.net... Use the InStr function to find the comma:
MyLastName = Left([NameField],Instr([NameField],",")-1))
-- PC Datasheet Your Resource For Help With Access, Excel And Word Applications re******@pcdatasheet.com www.pcdatasheet.com
"JLM" <je**********@colostate.edu> wrote in message news:40******@news.ColoState.EDU... Haven't seen this question yet.
I have a field that has "LastName,FirstName". I want to split that field into two, based on the comma. Size of LastName is obviously different in each record, so Left() won't work. Any ideas?
thanks in advance, jlm
Perfect..... thank you.
"PC Datasheet" <sp**@nospam.spam> wrote in message
news:P6******************@newsread1.news.atl.earth link.net... Peter's Mid function will do it for you. I just noticed that what I sent
you should have said MyFirstname instead of MyLastName. Here's Peter's Mid
function for the last name: MyLastName = Mid([NameField], Instr([NameField],",")+1 ,Len([NameField]))
Steve PC Datasheet
"JLM" <je**********@colostate.edu> wrote in message news:40******@news.ColoState.EDU... Thanks, this helps a lot. However, this works only for the left side of
the comma. I've messed with it and can't find the answer to get the right
side of the comma (less a single space).
jlm
"PC Datasheet" <sp**@nospam.spam> wrote in message news:ML*******************@newsread1.news.atl.eart hlink.net... Use the InStr function to find the comma:
MyLastName = Left([NameField],Instr([NameField],",")-1))
-- PC Datasheet Your Resource For Help With Access, Excel And Word Applications re******@pcdatasheet.com www.pcdatasheet.com
"JLM" <je**********@colostate.edu> wrote in message news:40******@news.ColoState.EDU... > Haven't seen this question yet. > > I have a field that has "LastName,FirstName". I want to split that field > into two, based on the comma. Size of LastName is obviously
different in > each record, so Left() won't work. Any ideas? > > thanks in advance, > jlm > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Henry Chen |
last post by:
Hi,
I have a string that needs to be parsed into the string. The separator is
not char. It is something like " at ". With current string.Split function,
it doesn't work. Is there any exist...
|
by: Senthil |
last post by:
Code
----------------------
string Line = "\"A\",\"B\",\"C\",\"D\"";
string Line2 = Line.Replace("\",\"","\"\",\"\"");
string CSVColumns = Line2.Split("\",\"".ToCharArray());
|
by: David Logan |
last post by:
We need an additional function in the String class. We need the ability
to suppress empty fields, so that we can more effectively parse. Right
now, multiple whitespace characters create multiple...
|
by: mb |
last post by:
I was wondering if there is an easy, more useful Split function that will
split with a string delimiter like "<>" or "////"?
|
by: Itzik |
last post by:
can i split this string
string str = "aa a - bb-b - ccc"
with this delimiter
string del = " - "
i want recieve 3 items : "aa a" , "bb-b" , "ccc"
|
by: J Stoodley |
last post by:
I am in a learning curve right now, and want to become well aquanted
with VB.NET. So, I have two questions. 1 is technial the other is
resource related.
1. I need to strip a single character...
|
by: Ron |
last post by:
Hello,
I am trying to parse a string on the newline char. I
guess vbCrLf is a string constant. How can I parse my
string - data - on the newline char?
....
data += ASCII.GetString(buffer, 0,...
|
by: Ben |
last post by:
Hi
I am creating a dynamic function to return a two dimensional array from a
delimeted string.
The delimited string is like:
field1...field2...field3...
field1...field2...field3......
|
by: kurt sune |
last post by:
The code:
Dim aLine As String = "cat" & vbNewLine & "dog" & vbNewLine & "fox" &
vbNewLine
Dim csvColumns1 As String() = aLine.Split(vbNewLine, vbCr, vbLf)
Dim csvColumns2 As String() =...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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,...
|
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |