Error DBFNTX/1022 Lock required

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: Error DBFNTX/1022 Lock required

Post 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
Attachments
lock.JPG
lock.JPG (72.41 KiB) Viewed 1354 times
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
carlazza
Posts: 22
Joined: Sun Nov 07, 2021 1:09 pm
DBs Used: DBF
Location: Italia

Re: Error DBFNTX/1022 Lock required

Post 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
franco
Posts: 921
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Error DBFNTX/1022 Lock required

Post by franco »

Could you use:
ON DBLCLICK {||{IIF(RLOCK(),EDIT("E"),UNLOCK},{MSGBOX('IN USE')}};
All The Best,
Franco
Canada
carlazza
Posts: 22
Joined: Sun Nov 07, 2021 1:09 pm
DBs Used: DBF
Location: Italia

Re: Error DBFNTX/1022 Lock required

Post 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?
franco
Posts: 921
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Error DBFNTX/1022 Lock required

Post 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')}};
All The Best,
Franco
Canada
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Error DBFNTX/1022 Lock required

Post by AUGE_OHR »

hi,
carlazza wrote: Sat Mar 12, 2022 5:25 pm it works!
! Note : when use RLOCK() you MUST UNLOCK
have fun
Jimmy
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Error DBFNTX/1022 Lock required

Post 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.

Andrés González López
Desde Guadalajara, Jalisco. México.
franco
Posts: 921
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Error DBFNTX/1022 Lock required

Post 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.
All The Best,
Franco
Canada
Post Reply