How to Add Information to Existing Data in a FieldLast reviewed: June 27, 1995Article ID: Q111312 |
The information in this article applies to:
SUMMARYIn order to use the REPLACE command to replace a field with the existing field contents plus more information, you must use the TRIM() function as part of the REPLACE statement. If the TRIM() function is not used, FoxPro seems to execute the replacements; however, the table is not updated.
MORE INFORMATIONThe contents of a field include any trailing blank spaces. When you attempt to replace a field with its existing contents plus additional data, the additional data will be concatenated to the end of the entire field including the trailing blanks. Since this is longer than the defined length of the field, the additional data will not be included when the field is updated. In order to add data to the existing contents of a field, you must remove the trailing blank spaces prior to adding the new data. You can accomplish this with the TRIM() function. The following program example is based on the assumption that C:\FOXPRO25 is the main FoxPro directory and that the TUTORIAL subdirectory and its contents are installed as one of the subdirectories under FOXPRO25. In this example, we will use CUSTOMER.DBF in the C:\FOXPRO25\TUTORIAL subdirectory and will update all records that have "1st" in the COMPANY field to add "Inc." to the end of this field. NOTE: Before making any changes to the original database, use the COPY TO command to make a backup copy of the existing database. Also, to find the CUSTOMER database for this example, make sure that the default directory is the main FoxPro directory.
Example
|
Additional reference words: FoxMac FoxDos FoxWin 2.0 2.50 2.50a 2.50b
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |