How to Use a Portion of a Memo Field in a List BoxLast reviewed: April 30, 1996Article ID: Q111672 |
The information in this article applies to:
SUMMARYThis article describes how to effectively use a portion of a memo field in a list box object that is part of a user-defined screen.
MORE INFORMATIONTo illustrate how to use a portion of a memo field in a list box object, suppose that the first 40 characters of the memo field are needed for the list box. If a list box object is created using the Screen Builder and the List Items From Field option is selected, then a reasonable expression to enter in the field expression dialog window is:
LEFT(<memo field name>,40)This expression will work well as long as all the first lines of all the memo fields in each record are at least 40 characters. If this is not the case, for example, if some of the memo fields have first lines that are less than 40 characters, the above statement will return the carriage return (CR) and linefeed (LF) characters and display them in the list box. Since this is not a desirable side-effect, the following two expressions will correct this situation. NOTE: Although the first expression works well, the second expression provides a more concise solution.
LEFT(<memo field name>,IIF(AT(CHR(13), <memo field name>); <40,AT(CHR(13),<memo field name>)-1,40)) -or- LEFT(MLINE(<memo field name>,1),40)The second expression works because the MLINE() function is going to return the characters for the first line of the memo field, up to but not including the CR/LF characters. The only thing to watch out for concerning the second expression is the current SET MEMOWIDTH value (the default line length is 50 characters). If the MEMOWIDTH is less than 40, no error will result, but only the number of characters corresponding to the MEMOWIDTH value will be returned. For example, if the MEMOWIDTH value is 35, only 35 characters will be returned from the second expression.
|
Additional reference words: VFoxWin FoxMac FoxDos FoxWin 2.00 2.50 2.50a
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |