>Hi Everyone,
>
>I am having trouble with a VFP grid that I use in my app. for invoicing. Everything works perfect when I add new items. The quantity and price columns are related by a multiply operation giving the right sub-total for that row. This equation is used in the "Lost Focus" method of each control. However if for example I am standing on item 2 row and click to change quantity (for example) for item 1, the subtotal for row 1 is calculated by the new quantity x the price of item 2. Why does this happen ?
>
>Now if I jump to price of item 1 and then loose focus of the control, the correct amount is displayed for sub-total.
>
>How can I fix this situation ?
Do your calculations in the grid's BeforeRowColumnChange or AfterRCC methods. When your code fires from a lostfocus, you're not quite sure as to which record is the recordsource of your controls. During the BRCC you're still sitting on the same row - and I'd actually recommend to try to use fields (i.e. replace command), not control.value. YMMV, of course, but I'm generally more comfortable dealing with fields than grid controls.