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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

append memo and for each --help 1

Status
Not open for further replies.

inncoggnitto

Programmer
Jun 19, 2001
77
US
i need to change every record's memo field in a table that i have extracted from a main table.

i have figured out the append memo part -

APPEND memo bi_text FROM oct_dec.txt OVERWRITE

and it does the first record. i cannot figure out how to make it change every record using sql. for loops seem like the logical thing but cannot get it to work. if there is another way (using a query maybe) i would appreciate some guidance.

there are only 222 records in the subset but no index field to increment, etc.

thanks
mike
 
Code:
SELECT MyTable
SCAN
    APPEND memo bi_text FROM oct_dec.txt OVERWRITE
** OR
**  
   REPLACE bi_text WITH FILETOSTR([oct_dec.txt])
ENDSCAN

*** OR

UPDATE MyTable SET bi_text = FILETOSTR([oct_dec.txt])
** But that is not tested


Borislav Borissov
 
tried the first two and get a "nesting error"

cmd window shot --- before
BROWSE LAST
scan
APPEND memo bi_text FROM oct_dec.txt OVERWRITE
endscan

******* after
BROWSE LAST
endscan

the first two lines disappear and i get the error - same for the replace
 
i went ahead and used your third suggestion on a copy of the table and it worked just great.

i appreciat the help.

i have lots of oracle and some paradox users around here but this is the lone foxpro db in the agency. it too is to be oracalized next month.

thanks again
 
inncoggnitto,

The command window doesn't work the same way as a command window in some of the other database command windows.
Each command in VFP is interpreted and executed as soon as you press <enter>. VFP doesn't wait for a 'terminate/execute' delimiter such as a ";".
That's why when you pasted the code and hit <enter>, only the last line was executed, which would give you the nesting error.

If you want to run multiple commands in the command window, such as:
Code:
SCAN
   APPEND memo bi_text FROM oct_dec.txt OVERWRITE
ENDSCAN

You need to first highlite (click+drag) the mouse over all the lines of code, then press <enter> or right click and select 'Execute selection'.

But usually when code is posted in the VFP forums, it is assumed you will place it in a program file where it can be ran, tested, saved, modified, and so on.

-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top