Trimming Names

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form where I enter first names into a field called, FirstNames.
After up-date I would like to trim the first names so that if two names are
entered, e.g. James Todd, only James is the defaulted into the PreferedName
field.

Thanks in advance

Nick
 
I have a form where I enter first names into a field called, FirstNames.
After up-date I would like to trim the first names so that if two names are
entered, e.g. James Todd, only James is the defaulted into the PreferedName
field.

Thanks in advance

Nick

Technically, as control source of an unbound control:
=IIf(InStr([FirstName]," ")>0,Left([FirstName],InStr([FirstName],"
")-1),[FirstName])

The above should not be stored in any table.

Personally, if someone sent me a letter addressed to me using my first
name it would go right into the trash.
There are a lot of people who do not use their first name, or always
use both names, i.e. Arthur Conan Doyle, George Bernard Shaw, etc.
 
I have a form where I enter first names into a field called, FirstNames.
After up-date I would like to trim the first names so that if two names are
entered, e.g. James Todd, only James is the defaulted into the PreferedName
field.

Thanks in advance

Nick

Look for the space with instr(FirstNames," "). If there is one, then
count the number of characters before the space; instr(FirstNames,"
")-1. Use Mid( ) to extract the first name.

FirstNames=iif(instr(FirstNames," ")>1,mid(FirstNames,
1,instr(FirstNames," ")-1,FirstNames)
 
Back
Top