* Form.load >Create cursor TestCursor ; > (Code c(10),Description c(30),Qnt i, Unit c(1),Cost i) >lnItems = 20 >For ix = 1 to lnItems > For jx=1 to 2 > lnAdjust = iif(jx=1,1,int(rand()*10)*10) > Insert into TestCursor ; > values ; > ('95A'+transform(ix*100+jx,'@L 9999')+'/1',; > iif(jx=1,'','% Adjustment for ')+iif(ix%2=0,'PLANT','LABOUR'),; > lnAdjust, iif(jx=1,'E','%'),; > iif(jx=1,int(rand()*100)*100,lnLastValue*lnAdjust/100) ) > lnLastValue = TestCursor.Cost > Endfor >Endfor >cursorsetprop('buffering',5,'testcursor') > >* Cost column (5) textbox.lostfocus >With this.Parent.Parent > lcAlias = .RecordSource > lcCurCode = eval(lcAlias+'.Code') > If at('1/1',lcCurCode)=0 > Return > Endif > lcAdjKey = stuff(lcCurCode,at('/',lcCurCode)-1,1,'2') > lnCost = eval(lcAlias+'.Cost') > Update (lcAlias) ; > set Cost = Qnt*lnCost/100 ; > where Code = lcAdjKey >Endwith>Note: Used local vars assuming recordsource name was not known beforehand. Otherwise I would directly say :
.. >If at('1/1',myTable.Code)=0 > Return >Endif >lcAdjKey = stuff(myTable.Code,at('/',myTable.Code)-1,1,'2') >..Cetin