Just so you're aware, storing names in one field is a sign of bad database design as last names can have more than one name, as can first names, and some people do not have middle names, and then there's jr's, and Dr. and...
So testing will have to be performed for these conditions.
The above solutions make incorrect assumptions, such as a last name will never have a space in them, etc.
Try:
whileprintingrecords;
stringvar firstname:=trim(mid({table.name},instr({table.name},",")+1));
// so far we have firstname and middle init combined
stringvar lastname:=trim(left({table.name},instr({table.name},",")-1));
// we have the last name in it's entirety ok
// now we fix the first name as best we can:
// assuming it has more than one part and there's
// a single character
// on the end, it's probably the middle initial
if ubound(split(firstname," ")) > 1 and
(left(right(firstname,2),1) = " "
then
firstname:=left(firstname,len(firstname)-2);
firstname&" "&lastname
Should work pretty well, additional coding may be required.
You should start leaving the want ads on the responsible dba's desk
-k