PRB: Using REPLACE to Concatenate Two Fields Doesn't Work

Last reviewed: June 27, 1995
Article ID: Q110370
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, and 2.5b
  • Microsoft FoxPro for MS-DOS, versions 1.02, 2.0, 2.5, 2.5a, and 2.5b
  • Microsoft FoxPro for Macintosh, version 2.5b

SYMPTOMS

When you are attempting to concatenate two fields together in one field, the REPLACE command does not work correctly.

For example, when you use the following REPLACE command

   REPLACE <field1> WITH <field1> + <field2>

and then browse the database after entering the above command, you will see no change in the data, although FoxPro indicated it made a number of replacements.

CAUSE

The field you are replacing is not large enough to accommodate the two fields including spaces.

RESOLUTION

To achieve the desired results, trim field1 and field2. For example:

   REPLACE <field1> WITH ALLTRIM(<field1>) + ALLTRIM(<field2>)


Additional reference words: FoxMac FoxDos FoxWin 1.02 2.00 2.50 2.50a 2.50b
replacing
does not
KBCategory: kbprg kbprb
KBSubcategory: FxprgBrowse


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.