Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find code from 10 fields
Message
From
07/08/2006 10:15:03
Mike Yearwood
Toronto, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01143440
Message ID:
01143449
Views:
8
>>Dear Experts
>>
>>Table1 has 10 numeric fields named Filed1,Field2,Field3 and so on to Field10.
>>The code=1301002 is located in some fields.
>>I want to replace it with 1501002,
>>
>>How to findout code=1301002 from whole table?
>>Table1 has no index order set.
>>
>>Please help
>
>
FOR mycount = 1 TO 10
>    curfield = "Field"+TRANSFORM(m.mycount)
>    REPLACE &curfield WITH 1501002 FOR &curfield = 1301002 ALL IN Table1
>NEXT
My response would be very similar to yours:
FOR mycount = 1 TO 10
    lcCmd = ;
      Field(m.mycount) ;
      + " WITH 1501002 FOR " ;
      + Field(m.mycount) ;
      + " = 1301002 "
    REPLACE &lcCmd. IN Table1
NEXT
The help says ALL means all records in the table. The FOR is limiting the records, so you're not doing all. ALL is therefore not required.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform