Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Balance
Message
 
 
To
23/09/1998 12:48:52
Senna Dwipayana
Indo Rebel Apparel Cv
Bandung, Indonesia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00139893
Message ID:
00139993
Views:
15
Senna,

Try this instead:
select (mytable)
nBalance = 0
scan
   nBalance = nBalance + in - out
   replace balance with nBalance
endscan
Your code keeps redoing the work over and over when you do the SELECT inside the loop.

>To count the balance field, usually I do like this :
>Select (mytable)
>Scan
> mrec=RECNO()
> SELECT SUM(out-in) FROM (mytable) WHERE RECNO()> mbalance=total+in-out
> REPLACE balance WITH mbalance
>ENDSCAN
>
>THIS Procedure take to long, specially if I edited a record in the middle, so I have to start all over again.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform