Microsoft KB Archive/105279

From BetaArchive Wiki
Knowledge Base


How to Remove Carriage Returns/Linefeeds from @ ... EDIT

Article ID: 105279

Article Last Modified on 12/3/2003



APPLIES TO

  • Microsoft Visual FoxPro 3.0 Standard Edition
  • Microsoft FoxPro 2.0
  • Microsoft FoxPro 2.5b for MS-DOS
  • Microsoft FoxPro 2.5a
  • Microsoft FoxPro 2.5b
  • Microsoft FoxPro 2.5a



This article was previously published under Q105279

SUMMARY

When information is entered in a character field in a database through an @ ... EDIT command and the RETURN key is pressed in the edit region during the input process, a carriage return and a linefeed are added to the text. These control codes can cause problems if the text field must be written out to a text file or another databases without control codes in the field.

To remove the carriage returns and linefeeds and replace them with a space in both FoxPro for MS-DOS and Windows, enter the following code either in the Command window or in a program

   REPLACE ALL <fieldname> WITH STRTRAN(<fieldname>,CHR(13)+CHR(10),' ')
                

where <fieldname> is the name of the database field that contains the carriage returns and linefeeds.

MORE INFORMATION

When the database is browsed in FoxPro for MS-DOS, you can view control codes in the fields. In the active record, the field will contain two accented characters together, an "i" and an "e" representing the carriage return and linefeed. In the other records in the Browse window, a musical note and a circle in a box represents the carriage return and linefeed. In FoxPro for Windows, the carriage return and linefeed are represented by two vertical bars in all records in the Browse window.


Additional query words: VFoxWin FoxDos FoxWin get line feed cr/lf

Keywords: KB105279