General information
Category:
Coding, syntax & commands
Title:
Record in Use problem in grid
Hi. I've gone back and searched about this problem but I cant figure out from all the previous messages what I should do, so here goes..
In my form when I am in a certain field of the grid and I press CTRL+Insert to add another record (without actually tabbing out of the field I just entered the value for), I get 'Record in Use by Another'.
My form has a grid that had a textbox which has some code in the Valid method:
LOCAL llok
THISFORM.CalcLineTot(THIS.ControlSource, THIS.Value)
llok=DODEFAULT()
IF llOK AND THISFORM.nFormStatus # 0 AND NOT EMPTY(apjcitm.code)
llOK = THISFORM.udfUpdIVCat(THIS, 'rate','nunitcost')
ENDIF
RETURN llOK
- The problem is shouwing up in the CalcLineTot method:
PARAMETER tcControlSource, tnValue
LOCAL lnTotal, loGrid, lnConv
** following added because next instruction does not see current
** control's value without it.
lnConv = 0
IF NOT EMPTY(tcControlSource)
IF EVAL(tcControlSource) # (tnValue)
REPLACE (tcControlSource) with (tnValue) in apjcitm
ENDIF
ENDIF
* pre-test conversion factor. If none found - force Rate Uom to same as Qty Uom and Rate to zero.
lnConv = ivconv(apjcitm.qtyuom,apjcitm.uom)
IF lnConv = 0
=Messagebox('There is no Conversion Factor in System to convert between ' + apjcitm.qtyuom + ' and '+ apjcitm.uom +'.' + chr(13) + ;
'Rate will be replaced with zero. Correct and try again.',32, _screen.caption)
Replace apjcitm.uom with apjcitm.qtyuom, apjcitm.rate with 0 in apjcitm
ENDIF
lnTotal = ROUND(apjcitm.rate*apjcitm.qty*ivconv(apjcitm.qtyuom,apjcitm.uom),2)
loGrid=THISFORM.pgfChildGrid.Page2.GrdGrid
IF apjcitm.total # lnTotal
***** THIS IS WHERE PROBLEM OCCURS *******
REPLACE apjcitm.total with lnTotal in apjcitm
ENDIF
THISFORM.pgfChildGrid.Page2.GrdGrid.Column9.txtTotal.Refresh()
---- This CalcLineTot is called from several places so that whenever the rate, qty, or either unit of measure fields change the total is recalcuated.
Any advise on how to get rid of this problem??? Am I doing something inherently wrong?
TIA,
Sandi
scassidy@canaccount.com
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only