I would like to know how one would go about taking string data in a "NAME" field and actually generating three fields (FNAME, MI, and LNAME). Do I need to create the fields in my table, first? Is VBA required? I really need for someone to walk me through the entire process if possible. Thanks in advance.
You will want to create the new fields first, but you won't need any
VBA: an Update query will do the trick.
Assuming (and you should check this assumption!!!) that the NAME field
contains names like
John Wilmot Vinson
Jaycee Jay
J. C. Jay
Kevin Lopear
I'd do it in three passes:
1. Run an Update query updating FName to
Left([Name], InStr([Name], " ") - 1)
and LName to
Mid([Name], InStr([Name], " ") + 1)
Do this by creating a Query based on your table; select the Name,
FName, and LName fields, changing it to an Update query with the query
menu item, and putting the following expressions on the Update To
line. Run the query by clicking the ! icon. The InStr function finds
the position of the first blank in [Name]; Left and Mid extract
substrings up to and starting with the specified position.
This will give FNames of "John", "Jaycee", "J.", and "Kevin", and
LNames of "Wilmot Vinson", "Jay", "C. Jay", and "Lopear" - i.e. first
names right, middle and last together in Last.
Then, create a second update query using FName, LName, MI; put a
criterion on the Criteria line of
LIKE "* *"
to limit the updates to only those names where there is a blank in the
LName field; names like "Jaycee Jay" and "Kevin Lopear" don't need any
further processing.
The Update To line should have for MI
Left([LName], InStr([LName], " ") - 1)
and for LName
Mid([LName], InStr([LName], " ") + 1)
The IMPORTANT third step is... MANUALLY go over this list and correct
the mistakes. THERE WILL BE MISTAKES. My friend Myrna Lou doesn't have
a middle name; her first name is "Myrna Lou", just ask her. And there
are two- and three-word last names such as "van Kleef" and "de la
Iglesia". Some names are very hard to distinguish without talking to
the person - is Jim Van Jones really Jim in the Van Jones family, or
does he just call himself "Jim Van", or is his middle name Van? Hard
to be sure!