I'm having trouble doing something that should be pretty simple.
I created a custom field for a table named SALDO
.
In my code a SELECT
is made to access the records that interest me with an alias TMP
. After that SELECT
loop these records and show to my user as a list of products. My user will change some values of aCols
and based on what it changes I should make a calculation and save this value in the bank in the SALDO
field of that registry, however I am not able to do this. What I tried and did not work for is the following:
DbSelectArea("TABELA")
RecLock("TMP2", .F.)
TMP2->SALDO := 400
MSUnLock()
I can not post my complete code per company policy but an outline of how it works can be seen below:
_cQuery := "SELECT C1,C2,C3,C4,SALDO FROM TABELA
_cQuery := ChangeQuery(_cQuery)
TCQUERY _cQuery NEW ALIAS "TMP"
DbSelectArea("TMP")
DbGoTop()
While TMP->(!(EOF()))
//Carrega valores no aCols dentro do while
RecLock("TMP2", .F.)
TMP2->SALDO := 400
MSUnLock()
TMP->(Dbskip())
EndDo
TMP->(DbCloseArea())
I'm getting the error TOP Error -19 - Invalid Operation - Update NOT ALLOWED on Query File.
when I try to update.