HOW TO SPLIT INITIALS IN A NAME - my first post - pls help

G

Guest

Dear All
I have about 3 thou odd names. The initials, first name, last name all
entered in one field. My first task is to sort these names by initials in
one field, first name in one field and last name in another field. Pls advice.
 
G

Guest

If all fields contain three parts you can use in a query as new fields

Initials: Left([FieldName] , Instr([FieldName]," ")-1)
take the string from the beggining until the first space

FirstName:Mid([FieldName] , Instr([FieldName]," ")+1, InstrRev([FieldName],"
")-1)
take the string from the first space to the second one

LastName:Mid([FieldName] , InstrRev([FieldName]," ")+1)
Take the string from the last space to the end

Note: field that don't includes all three parts won't give you the desire
resault
 
G

Guest

D/Cohen--Thanks for giving me a start.
I forgot to inform that i am using access-97.
I went into querry and in criteria =Left([NAME_AWRY] ,
Instr([NAME_AWRY],"")-1) .
When i run this querry I get procedure error. . pls help

Ofer Cohen said:
If all fields contain three parts you can use in a query as new fields

Initials: Left([FieldName] , Instr([FieldName]," ")-1)
take the string from the beggining until the first space

FirstName:Mid([FieldName] , Instr([FieldName]," ")+1, InstrRev([FieldName],"
")-1)
take the string from the first space to the second one

LastName:Mid([FieldName] , InstrRev([FieldName]," ")+1)
Take the string from the last space to the end

Note: field that don't includes all three parts won't give you the desire
resault

--
Good Luck
BS"D


CAPTGNVR said:
Dear All
I have about 3 thou odd names. The initials, first name, last name all
entered in one field. My first task is to sort these names by initials in
one field, first name in one field and last name in another field. Pls advice.
 
G

Guest

D/Ofer
I also tried putting this in the field area for expressions:
Initials: Left([NAME_AWRY],InStr([NAME_AWRY]," ")-1)

Unfortunately since the names are without any spaces after the initials, it
is giving error for names like A.P.A.PETER GREG.

pLS ADV

Ofer Cohen said:
If all fields contain three parts you can use in a query as new fields

Initials: Left([FieldName] , Instr([FieldName]," ")-1)
take the string from the beggining until the first space

FirstName:Mid([FieldName] , Instr([FieldName]," ")+1, InstrRev([FieldName],"
")-1)
take the string from the first space to the second one

LastName:Mid([FieldName] , InstrRev([FieldName]," ")+1)
Take the string from the last space to the end

Note: field that don't includes all three parts won't give you the desire
resault

--
Good Luck
BS"D


CAPTGNVR said:
Dear All
I have about 3 thou odd names. The initials, first name, last name all
entered in one field. My first task is to sort these names by initials in
one field, first name in one field and last name in another field. Pls advice.
 
L

Larry Linson

Why would you put such an expression in the Criteria? That is testing for
the value of the field being the result of the expression, and, from your
description, if that were the case, it would be an error in your data.

Also, the questions that get the most accurate answers are precise and
concise, and your description did not state the "delimiters", nor give an
example. For other good suggestions on effective use of newsgroups see the
FAQ at http://www.mvps.org/access/netiquette.htm.

I'd suggest you post the question, with details, clarification, and the
example as a followup in hopes that someone can/will offer a useful
suggestion.

Larry Linson
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top