RichardOneil
MIS
Hi-
I have a name field that I need to split into first name, last name and middle initial. The format of the field is LASTNAME,FIRSTNAME MI. I have an array that first splits the LASTNAME and FIRSTNAME MI:
SName = rs!Name
nmval2 = Mid$(SName, 1, Len(SName))
MyArray2 = Split(nmval2, ",")
LName = MyArray2(0)
FName = MyArray2(1)
I then repeat the process to split the first name from the MI, using a space instead of the comma as the split value.
nmval3 = Mid$(FName, 1, Len(FName))
MyArray3 = Split(nmval3, " ")
FName = MyArray3(0)
MName = MyArray3(1)
The problem I am running into is that not every record has a middle name so I get a "Subscript is Out of Range Error" on these records. I have tried trapping the null by using IF IsEmpty and If IsNull to no avail. Thanks in advance.
Richard
I have a name field that I need to split into first name, last name and middle initial. The format of the field is LASTNAME,FIRSTNAME MI. I have an array that first splits the LASTNAME and FIRSTNAME MI:
SName = rs!Name
nmval2 = Mid$(SName, 1, Len(SName))
MyArray2 = Split(nmval2, ",")
LName = MyArray2(0)
FName = MyArray2(1)
I then repeat the process to split the first name from the MI, using a space instead of the comma as the split value.
nmval3 = Mid$(FName, 1, Len(FName))
MyArray3 = Split(nmval3, " ")
FName = MyArray3(0)
MName = MyArray3(1)
The problem I am running into is that not every record has a middle name so I get a "Subscript is Out of Range Error" on these records. I have tried trapping the null by using IF IsEmpty and If IsNull to no avail. Thanks in advance.
Richard