>I just changed the code to select before the replace. No help. I know that in other places in my app I replace in other work areas all the time, so I experimented in the command window just to be sure:
>
>USE table1 in 0
>USE table2 in 0
>sele table 1
>replace table2.field1 with "ZZZZZ"
>
>This works fine. The table gets updated no problem.
The tricky thing about replacing into another work area is that most of the time it will work. When it fails it generates no error message. The problem occurs if table1 is at EOF. The replace will fail in this case. The safe way to do a replace is select the table first. In VFP you also have another option, add the IN TableAlias clause to the replace (REPLACE Field1 WITH "ZZZZ" IN Table2).