I have a mailing list in which the name field may contain 2 names such as:
Mr. John Smith and Ms. Mary Jones
This should be split to 2 fields on the word " and ":
Name1 = Mr. John Smith
Name2 = Ms. Mary Jones
The name field may also contain:
Mr. and Mrs. James Smith
This should not be split on the word " and " but should end up as:
Name1 = Mr. and Mrs. James Smith
I would like to determine the word number (if it exists) of the word " and " in the string so I can split the field if the " and " is word number 3 or higher.
Something like:
Any help would be greatly appreciated!
Thanks,
Sup
Mr. John Smith and Ms. Mary Jones
This should be split to 2 fields on the word " and ":
Name1 = Mr. John Smith
Name2 = Ms. Mary Jones
The name field may also contain:
Mr. and Mrs. James Smith
This should not be split on the word " and " but should end up as:
Name1 = Mr. and Mrs. James Smith
I would like to determine the word number (if it exists) of the word " and " in the string so I can split the field if the " and " is word number 3 or higher.
Something like:
Code:
Function MaxWordNum(strNameFld as string, strWord as string)
'find the word number of the last occurance of strWord within strNameFld
'then split the string on MaxWordNum if MaxWordNum > 2
End Function
Any help would be greatly appreciated!
Thanks,
Sup