Seperating Full Name

  • Thread starter Thread starter Jo K.
  • Start date Start date
J

Jo K.

I have a bounded field called Name.
It's used to type in the full name of a customer (intentionally set up that
way instead of seperating the first and last names)
I would like to be able to seperate the names in say a report.
When merging data from the database to a word document, I would like the
database to insert the first name for the "Dear" part of the letter. eg.
James Smith is the full entry in the field.
The report would simply take out the James part and insert it after the Dear
part of the letter..... Dear James,
What expression could I use in the unbound text box to give me the "James"
part ?
thanks for any assistance.
 
Use Split

dim sp
sp=split(textbox.text," ")
textbox.text="Dear " & sp(0)

Madhivanan
 
I really don't know where I'm supposed to put this code in.
When I click on the properties of the "unbounded text box (where the first
name will end up) i can't access the Event tab.
where do I place the code ?
 
I have a bounded field called Name.
It's used to type in the full name of a customer (intentionally set up that
way instead of seperating the first and last names)
I would like to be able to seperate the names in say a report.
When merging data from the database to a word document, I would like the
database to insert the first name for the "Dear" part of the letter. eg.
James Smith is the full entry in the field.
The report would simply take out the James part and insert it after the Dear
part of the letter..... Dear James,
What expression could I use in the unbound text box to give me the "James"
part ?
thanks for any assistance.

This can be VERY VERY difficult. I have a friend named Dolpha Mae
Watson. Her first name is Dolpha Mae (NOT Dolpha); just ask her or
anyone who knows her. I also know people with names like Hans van
Slyke - his first name is Hans, not Hans van.

These are some of the reasons that it's universal to store first and
last names separately. It's very easy to put them together once
separated, but very tricky to take them apart!

That said... what you CAN do (with the risk of annoying all the Dolpha
Maes and Billy Bobs out there) is to put a calculated field in your
Query by typing:

FirstName: Left([Name], InStr([Name], " ") - 1)

and using this field in your report. The same expression can be used
as the control source of a textbox (just replace FirstName: with an
equals sign =).

John W. Vinson[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

Back
Top