Locks the current record or a specified list of records in the current or specified table.

Syntax

RLOCK([<list expC>, <alias>] | [<alias>])

<list expC>

The list of record numbers to lock, separated by commas. If omitted, the current record is locked.

<alias>

The work area to lock.

You don't have to specify record numbers if you want to specify a value for <alias> only. However, if you have specified record numbers, you must specify an <alias>.

Description

Use RLOCK( ) to lock the current record or a list of records in any open table. If you don't pass RLOCK( ) any arguments, it locks the current record in the current table. If you pass only <alias> to RLOCK( ), it locks the current record in the specified table. If RLOCK( ) is successful in locking all the records you specify, it returns true; otherwise it returns false. You can lock up to 100 records in each table open at your workstation with RLOCK( ).

You can view and update a record you lock with RLOCK( ). Other users can view this record but can't update it. When you lock a record with RLOCK( ), it remains locked until you do one of the following:

Issue UNLOCK

Close the table

All commands that change table data cause dBASE Plus to attempt to execute an automatic record or file lock. If dBASE Plus fails to execute an automatic record or file lock, it an error occurs. You might want to use RLOCK( ) to handle a lock failure youself, instead of letting the error occur.

RLOCK( ) can't lock the records you specify when any of the following conditions exist:

Another user has locked, explicitly or automatically, the current record or one of the records in <list expC>.

Another user has locked, explicitly or automatically, the table that contains the records you’re trying to lock.

When SET REPROCESS is set to 0 (the default) and RLOCK( ) can't immediately lock its records, dBASE Plus prompts you to attempt the lock again or cancel the attempt. Until you choose to cancel the function, RLOCK( ) repeatedly attempts to get the record locks. Use SET REPROCESS to eliminate being prompted to cancel the RLOCK( ) function, or to set the number of locking attempts.

RLOCK( ) is similar to FLOCK( ), except FLOCK( ) locks an entire table. Use FLOCK( ), therefore, when you need to have sole access to an entire table or related tables—for example, when you need to update multiple tables related by a common key—or when you want to update more than 100 records at a time.

When you set a relation in a parent table with SET RELATION and then lock a record in that table with RLOCK( ), dBASE Plus attempts to lock all child records in child tables. For more information on relating tables, see SET RELATION.

RLOCK( ) is equivalent to LOCK( ).

OODML

Use the Rowset object’s lockRow( ) method.