>Hi!
>
>Is it possible to create a computed column in a grid and still be able to edit it?
>
>I have a column in a grid with it's controlsource set to the lookup() function which returns the description (of its foreign key column)
>
>Grd1.Col1.ControlSource = LookUp(alias2.fld2,alias1.fld1,alias2.fld1)
>Grd1.Col1.Bound = .T.
>
>It displays the values OKay but text1 (currentcontrol of the column) is readonly and I cannot type in anything in text1 of that column. Text1 does not even get focus.
>
>Thanks
>
>Sarosh
Sarosh,
Calculated columns are always readonly. In your case in a way fld1 mimic a relation and you get fld2 to display. If instead you set a relation between 2 tables and use directly alias2.fld2 as controlsource then you could edit it. But beware in this case when you edit one, you're actually editing it for all fld1 matches.
fld1 fld2
---- ----
0001 item1
0002 item2
0001 item1
When you change item1 to myitem in any row, all item1 become myitem (just you go and edit directly table2).
Cetin