Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best practice – Form Calculations
Message
From
01/05/2005 23:14:29
 
 
To
01/05/2005 03:03:05
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01009973
Message ID:
01010073
Views:
29
Thanks! I appreciate the responses.

Sergey’s approach is the one I am familiar with from DOS days, using memory variables.

I am running into the same problem using either Sergey’s or Glenn & Tore’s method.

The problem is that TxtnTotal is carrying over the total from the previous form when I hit new.

How do I get txtnTotal to initialize to zero for a new record?

Table Junk
Key c 8
Myvalue1 n 10 2
Myvalue2 n 10 2

On form Fields
TxtMyValue1 control source Junk.Myvalue1
TxtMyValue2 control source Junk.Myvalue2
TxtnTotal control source <>

Form::Calculateit
WITH Thisform
.txtnTotal.value = .txtMyValue1.value + .txtmyvalue2.value
ENDWITH

Sergey’s Approch:

Form::Init
DODEFAULT()
Thisform.Calculateit()

TxtMyValue1::Valid
Thisform.Calulateit()

TxtMyValue2::Valid
Thisform.Calulateit()

Glenn & Tore’s Approch:

Form::Init
DODEFAULT()
Bindevent(this.txtMyValue1,”lostfocus”,this,”Calculateit”,1)
Bindevent(this.txtMyValue2,”lostfocus”,this,”Calculateit”,1)
Thisform.Calculateit()
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform