dtucker
asked on
separateing first and last names
I have a database field that consists of first and last names. I would like to retrieve the first name and the last name separately. Using VB4 16 bit, how would I go about retrieving first name and last name so I have two fields, first and last?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
iSpacePos = Instr(sCombinedName, " ")
if iSpacePos > 0 then
FName = mid(sCombinedName, 1, iSapcePos)
LName = mid(sCombinedName, iSpacePos + 1)
else
FName = sCombinedName
endif
if Last name <comma> first name....
icommapos = instr(sCombinedName, ",")
if icommapos > 0 then
LName = mid(sCombinedName, 1, iCommaPos)
FName = mid(sCombinedName, iCommaPos + 1)
else
LName = sCombinedName
end if
If you have another format, let me know what it is