Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help - Return character in comment field, VDB 5.7

Status
Not open for further replies.

Jimvdb

Technical User
Jun 1, 2004
1
US
I have a 254 character comment field which is in character format. If someone hits the return key when in the field in a form, it inserts a return character (which appears as a vertical line).

When appending records to another file, when the append gets to the comments field (and the return character), it scrambles the file after that point and skews the data incorrectly in the following fields throughout the database.

Any idea on how this can be stopped?

Thanks!
 
The return key may have inserted a CHR(13), CHR(10), both, or something else. First you'll have to find out exactly what was inserted that's causing you problems. Often nulls are the bad guys. That's CHR(0). Why not list out each value to find the culprit?
Code:
* first go to a record with the incorrect characters
FOR x = 1 TO LEN(myField)
   ? STR(x,3)+STR(ASC(SUBSTR(myField,x,1)),4)
   IF MOD(x,15)=0
      WAIT  && pause
   ENDIF
NEXT
After you find out that the exact characters are, then you can replace them with something else, as long as it doesn't adversely affect the integrity of the data or programs and other users and developers there agree it's okay.
Code:
xChr = CHR(0) && whatever the bad character(s) are
xNew = CHR(32)  && whatever to replace it with
SCAN
   DO WHILE xChr $ myField
      xLoc = AT(xChr,myField)
      REPLACE myField WITH LEFT(myField,xLoc-1) ;
           +xNew+SUBSTR(myField,xLoc+LEN(xChr))
   ENDDO
ENDSCAN
dbMark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top