|
-
Jul 7th, 2004, 01:20 PM
#1
Thread Starter
Hyperactive Member
Name function...help!!!
This is the data I can have:
Johnson, Tom G
Johnson Tom G
Johnson Tom
This is the function I have so far:
Function MiddleName(ByVal WholeName As String) As String
Dim arr() As String
Dim MName As String
Dim pos As Integer
WholeName = Replace(WholeName, ",", " ")
arr = Split(WholeName, " ")
pos = WholeName.IndexOf(" ")
If pos > 0 Then
MiddleName = " " + arr(2) + " "
Else
MiddleName = ""
End If
Return MiddleName
End Function
It gets the middle name, but if there is no middle name it gives me an error. How can I fix that? Please help!
Brenda
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|