RE: Parsing a Text String into 4 Different Fields
- From: Dale Fye <dale.fye@xxxxxxxxxx>
- Date: Tue, 31 Mar 2009 14:00:08 -0700
Well, you might use the Split command to split the data up in the data entry
forms load event. The problem is deciding which field to put it in,
especially WRT you last comment about this possibly being a "Company name"
rather than a person.
I guess you could first check to see if there is a comma. If so, take the
whole text and put it in some field (lastname does not seem to fit here).
Then, if there is a comma, you could use Left$() to get everything to the
left of the comma, and put it in the last name. Then use Mid$() to chop off
the last name so that you have a subset of the data to work with. Then you
could use the split to parse the remainder based on spaces, or you could use
the InStr( ) function and look for spaces as your break points for FirstName
and Middle Name.
----
HTH
Dale
"RayToddJr" wrote:
I have a form that contains a combo box (cboDefendantsName) that contains the.
following field:
DefendantName: [LastName] & (", "+[FirstName] & " " & [MiddleName] & " " &
[Suffix])
If the user enters a name that isn't in the list, it will open dataentry
form to allow the user to put this information in the table.
When the data entry form is opened, I would like the information to be
transferred from the originating form via openargs. Once the data is in the
data entry form, I would like for it to be broken down into the four fields
so as to keep the user from having to enter the information twice (one in the
original form and second n the data entry form).
The data would need to be parsed into
LastName
FirstName
MiddleName
Suffix
Keep in mind that the lastname field is also used as a company name and
therefore may not have a "," after it.
Can anyone please share with me on how to parse this field?
Thanks,
Ray.
- References:
- Parsing a Text String into 4 Different Fields
- From: RayToddJr
- Parsing a Text String into 4 Different Fields
- Prev by Date: RE: 2003 Access menu bar disappears
- Previous by thread: Parsing a Text String into 4 Different Fields
- Next by thread: Delete Records that are > 90 Days
- Index(es):
Relevant Pages
|