Page 2 of 2

Re: Error DBFNTX/1022 Lock required

Posted: Sat Mar 12, 2022 4:06 pm
by SALINETAS24
carlazza wrote: Sat Mar 12, 2022 2:40 pm I wrote this post just to ask how to fix the lock problem
Hola amigo, Me refiero si habias probado la CLAUSULA LOCK que tiene la clase browse...., igual ahora me explico mejor

Re: Error DBFNTX/1022 Lock required

Posted: Sat Mar 12, 2022 5:00 pm
by carlazza
SALINETAS24 wrote: Sat Mar 12, 2022 4:06 pm
carlazza wrote: Sat Mar 12, 2022 2:40 pm I wrote this post just to ask how to fix the lock problem
Hola amigo, Me refiero si habias probado la CLAUSULA LOCK que tiene la clase browse...., igual ahora me explico mejor
Ok Ok amigo.

I've already done it but doesn't work.

Thx

Re: Error DBFNTX/1022 Lock required

Posted: Sat Mar 12, 2022 5:12 pm
by franco
Could you use:
ON DBLCLICK {||{IIF(RLOCK(),EDIT("E"),UNLOCK},{MSGBOX('IN USE')}};

Re: Error DBFNTX/1022 Lock required

Posted: Sat Mar 12, 2022 5:25 pm
by carlazza
Looking for the code in the example, adding only the code

IF FE->( RLOCK() )
FU->FIELD1 := XXX
FU->FIELD2 := XXX
FU->FIELD3 := XXX
FU->FIELD4 := XXX
ENDIF

it works!

how is it possible? What does that statement do?

Re: Error DBFNTX/1022 Lock required

Posted: Sat Mar 12, 2022 6:11 pm
by franco
I use this a lot in my grids and browses.
It only allows the edit if it gets a lock.
you can try taking out the unlock, then try the second edit with same code, It should not get a lock because the first edit has it locked.
in first edit
ON DBLCLICK {||{IIF(RLOCK(),EDIT("E"), },{MSGBOX('IN USE')}};

Re: Error DBFNTX/1022 Lock required

Posted: Sat Mar 12, 2022 8:47 pm
by AUGE_OHR
hi,
carlazza wrote: Sat Mar 12, 2022 5:25 pm it works!
! Note : when use RLOCK() you MUST UNLOCK

Re: Error DBFNTX/1022 Lock required

Posted: Sat Mar 12, 2022 8:58 pm
by andyglezl

Code: Select all

    FU->(dbGoTo ( CDL2A.Br_cassaout.Value ))
    IF RegEnRed( "FU" )
        FU->FIELD1 := XXX
        FU->FIELD2 := XXX
        FU->FIELD3 := XXX
        FU->FIELD4 := XXX
    ELSE
        MsgInfo("No se pudo grabar el Registro...","Verifique" )
    ENDIF
    UNLOCK
RETURN NIL

FUNCTION RegEnRed( cArea )
    DO WHILE ! ( cArea )->( RLock() )
        IF ! MSGRetryCancel( "Registro usado por otro Usuario", cArea )
            RETURN .F.
        ENDIF
    ENDDO
RETURN .T.


Re: Error DBFNTX/1022 Lock required

Posted: Sun Mar 13, 2022 4:53 pm
by franco
Jimmy,
My first post is the proper way. It unlocks on return.
My second post was for Carl to test his second use of same record in second table to see that he could not get lock as it was still locked in first.