pessimistic locking

G

Guest

Hi,

I use pessimistic locking on a form which may be accessed by multiple users.

Is there a property to check if the locking has been triggerd by another user?

For instance UserA is editing the record, this record is then locked for
editing for UserB.

If UserB then clicks a button on this form I would like to be able to bring
up a dialogue saying that this current record is locked by another user.

Is there a simple way to check if the current record is locked ?

Many thanks!
 
G

Guest

Access already includes an indication of a locked record when using
pessimistic locking by showing the Ø (slashed O) symbol on the record
selector, so be sure that the form's RecordSelector property is True.

Ken Sheridan
Stafford, England
 
G

Guest

Just to amplify on that:

The symbol shows when the user attempts to edit a locked record, so if you
want to use a button you could attempt to Dirty the form by setting the value
of an *editable* control to its current value and trap the error, popping up
a message box if you don't want to rely on the symbol on the record selector.
Code for a button would go something like this:

On Error Resume Next
Me.SomeControl = Me.SomeControl
If Err <> 0 Then
MsgBox "Record Locked.", vbInformation, "Warning"
Else
Me.Dirty = False
End If

Ken Sheridan
Stafford, England
 
G

Guest

Thanks for the Reply.

The record selectors are not visible.

I had thought of trapping an error with a loop rechecking every few seconds,
with the ability to cancel by the user.

Access obviously knows that the record is locked as it does display the icon
- so I am suprised that there is no property that I check.

Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top