Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADD Cell in a GRID 2

Status
Not open for further replies.

Gert

Programmer
Apr 9, 2000
240
DO
Hi all
I have a grid wich got 5 columns, what I would like to do is:


Add the first 4 columns and store the value average in the other column.

the table's name is "tblNotas", and the 5 controlsourse are named.

yannot, febnot, marnot, abrnot, totnot
all ar numeric value

what i'm doing is:

thisform.grid1.column6.controlsource = (tblnotas.yannot + nblnotas.febnot + tblnotas.marnot + tblnotas.abrnot)/4

or this way:

thisform.grid1.column6.text1 = (tblnotas.yannot + nblnotas.febnot + tblnotas.marnot + tblnotas.abrnot)/4

but it doesn;t work neither,
What could I do in order to ADD this value,

SOme help will be aprecite.

Thanks in advance











 
Have you tried:
thisform.grid1.column6.controlsource = "(tblnotas.yannot + nblnotas.febnot + tblnotas.marnot + tblnotas.abrnot)/4"

That is, the controlsource should always be a string expression, so your controlsource should be placed in between quotes ("").

HTH,


Weedz (Wietze Veld)
My private project:And especially for VFP rookies:
 
There are several ways to do this. This is the one I usually use.

1. Create a method in the form the grid is on that will do your calculation and return the answer you need. For example 'mycalc'

2. Set the column's controlsource to thisform.mycalc.

3. Set the column's bound property to .f.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top