Salut Zetchoume,
Start by creating a new method in your form (Form|New method) named DisplayNbParts(). In that method, place your code to calculate the number of parts:
IF THISFORM.txtSexe.Value = "M" AND THISFORM.txtFamilySituation.Value = "M"
THISFORM.txtParts.Value = 2
ELSE
ENDIF
Then, put the following in the LostFocus() event of the Sexe and Family Situation textboxes: THISFORM.DisplayNbParts()
HTH
>I would like you to help me in this subject.
>
>I'm new in Visual Foxpro 5.0. I have a form with the following fields, not exhaustive :
>
>Sexe : Male or Female (M or F)
>Family situation : married, bachelor, divorced (M, B, D)
>Number of children (1, 2 , 3, ...)
>Number of parts
>
>I want to determine the number of parts after filling the three first fields.
>
>For instance :
>
>If sexe = Male and family situation = Married and number of children = 2 then the number of parts = 2
>
>I would like, after determining the number of parts, to enter the result in a texbox named PARTS.