lockcurrentrecord()

The lockcurrentrecord( function attempts to lock the current record, returns true if successful, false if failed.


Parameters

No parameters.


Description

This function attempts to lock the current record. It returns true if the record successfully locked, or false if the attempt failed (for example if the record is locked on another computer). Either way, the result is returned immediately, this function does not wait if the record cannot be locked.

if lockcurrentrecord()
    Quantity = Quantity-1
    unlockrecord
else
    message "This item is currently being edited by another user, please try again later."
endif

If you want to find out additional detail about the lock attempt you can use the dbinfo( function with either the lockstatus or lockmessage options.

The lockstatus option returns the status of the last attempt made to lock a record. The possible results are:

The lockmessage option returns detail information about the last attempt made to lock a record. For example if the record is locked by another user, this message will include that user’s name and their computer name.

In addition to this function, you can also use the lockrecord statement or the lockorstop statement to lock the current record.


History

VersionStatusNotes
10.2NewNew in this version.