> > Hi Stefan,
> > Thanks alot,
> > i have a form with a grid eg grid1. In the click prodedure of grid1 in column4, i have this code.
> >
> > WITH THISFORM
> > DO CASE
> > CASE .grid1.column3.text1.value>80
> > thisform.grid1.column4.text1.value="Distinction"
> >
> > CASE .grid1.column3.text1.value>=70
> > thisform.grid1.column4.text1.value="Credit"
> >
> > CASE .grid1.column3.text1.value>=55
> > thisform.grid1.column4.text1.value="pass"
> >
> > CASE .grid1.column3.text1.value<55
> > thisform.grid1.column4.text1.value="Fail"
> > ENDCASE
> > ENDWITH
> >
> > The code is working well, but when i move to the next cell in the next row, the value of the upper cell is inserted into this new cell and not a new value eg a new grade. The grade should change depending on the value of marks in a given cell
> >
>
> I'd suggest not to use a Click() event for that, try the following in your Grid1.Column3.Text1.Valid() (Replace "yourResultField" in the code with your desired field name, i.e. the column4.ControlSource):
>
>
> LOCAL lnResult
> lnResult = This.Value
> REPLACE NEXT 1 yourResultField With ICASE( ;
> m.lnResult > 80, 'Distinction', ;
> m.lnResult >= 70, 'Credit', ;
> m.lnResult >= 55, 'pass', ;
> m.lnResult < 55, 'Fail', ;
> 'n/a' ) IN This.Parent.Parent.RecordSource
>
>
>
>
> hth
> -Stefan
Thanks Stefan, the code worked perfectly....thanks alot and God bless you
But i have another problem,
1. What is the best way to sum numeric values in a grid eg i have a grid called grid1 with six columns: No, name, marks1, marks2, total,and grade.
I want to sum values of 'marks1' and 'marks2' and store them in 'total' and then grade the total and store the text value like "pass" or "fail" in 'grade' column
2. When am grading the value in the 'total' column i also need to check if columns 'marks1' and 'marks2' have values or are empty and then grade the total based on this. In other words, if the student did not sit for one of the exam, that means either 'marks1' or 'marks2' is empty, then the grade should be "Course not complete". I hope you got it. Thanks.
Danson