>VFP 6.0
>SP 5
>Windows 98
>
>Anyone can help me?
>
>How can I calculate a column in Grid poblated by free fields.
>My coding is like this:
>
>If x=.t.
This can be simplified as:
if x
... since x is already of a logical type.
if x
LnMyVariable = 1
Else
LnMyVariable = 2
Endif
Spaces in VFP code are preserved if you use the HTML codes < PRE > (at the beginning), and < /PRE > (at the end). (Without spaces.)
>select DETAILS
>Thisform.GridLiquidac.RecordSource = 'DETAILS’
>Thisform.GridLiquidac.Liquid.ControlSource='DETAILS.Field1'
>Thisform.GridLiquidac.Item.ControlSource ='DETAILS.Field2' Thisform.GridLiquidac.Weight.ControlSource='DETAILS.Field3'
>Thisform.GridLiquidac.Libras.ControlSource='DETAILS.Field3' * LnMyVariable
>Thisform.GridLiquidac.refresh()
>
>* But can´t obtaind the desired results, and receive the error message: Data type Mismatch when I define like this:
>
>'DETAILS.Field3' * LnMyVariable
I think you should put quotations marks around the entire expression:
Thisform.GridLiquidac.Libras.ControlSource="DETAILS.Field3 * LnMyVariable"
or perhaps:
Thisform.GridLiquidac.Libras.ControlSource="=DETAILS.Field3 * LnMyVariable"
Try both, and see which works.
Saludos,
Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)