SET STEP ON CREATE TABLE myTable ( cMemoField m ) INSERT INTO myTable VALUES("This is a test of the emergency broadcast system. This is only a test.") INSERT INTO myTable VALUES("Yesterday was the day before today, which could be the last day of the rest of my life.") SELECT CAST(getUnbrokenWordsToCharCount(cMemoField,50) AS c(200)) AS cField ; FROM myTable ; INTO CURSOR c_list BROWSE NOWAIT CANCEL FUNCTION getUnbrokenWordsToCharCount LPARAMETERS tcMemo, tnMaxLength LOCAL lnI, lcOutput, lcWord * Remove any CR/LF tcMemo = CHRTRAN(tcMemo, CHR(13)+CHR(10), SPACE(1)) * Initialize our return string lcOutput = SPACE(0) FOR lnI = 1 to GETWORDCOUNT(tcMemo) * Grab this word lcWord = GETWORDNUM(tcMemo, lnI) * Will it be too much? IF LEN(lcOutput) + LEN(lcWord) > tnMaxLength * All done RETURN lcOutput ENDIF * Concatenate lcOutput = lcOutput + IIF(EMPTY(lcOutput), SPACE(0), SPACE(1)) + lcWord NEXT * The entire string was usable RETURN lcOutput