Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Record in Use problem in grid
Message
From
14/06/2002 12:05:41
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Record in Use problem in grid
Miscellaneous
Thread ID:
00668600
Message ID:
00668600
Views:
53
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
Map
View

Click here to load this message in the networking platform