check, if a record is actually locked by another user


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: check, if a record is actually locked by another user

  1. #1
    Thanh-Nhan Le Guest

    check, if a record is actually locked by another user


    Can I check, if a record is actually locked by another
    user?

    I want allow the user to edit a record (on a form), only
    when it isn't locked by another user. Until now I do so
    with DAO, the RecordLock Property of the form is set to 2:

    On error goto cmdEdit_Click_Err
    dim rs as Recordset
    set rs = me.recordsetClone
    rs.Bookmark = me.bookmark
    rs.edit
    rs.Update

    'hier enable the Text controls.... to allow the user edit
    .......

    cmdEdit_Click_Exit:
    Exit Sub

    cmdEdit_Click_Err:
    ' Record is locked
    If Err.Number = 3260 Then
    MsgBox Err.Description
    Else
    MsgBox Err.Number & " " & Err.Description
    End If
    Resume cmdEdit_Click_Exit


    Thanks
    le.nhan@web.de


  2. #2
    Paul Clement Guest

    Re: check, if a record is actually locked by another user

    On 22 Aug 2001 00:51:22 -0700, "Thanh-Nhan Le" <le.nhan@web.de> wrote:


    Can I check, if a record is actually locked by another
    user?

    I want allow the user to edit a record (on a form), only
    when it isn't locked by another user. Until now I do so
    with DAO, the RecordLock Property of the form is set to 2:

    On error goto cmdEdit_Click_Err
    dim rs as Recordset
    set rs = me.recordsetClone
    rs.Bookmark = me.bookmark
    rs.edit
    rs.Update

    'hier enable the Text controls.... to allow the user edit
    ......

    cmdEdit_Click_Exit:
    Exit Sub

    cmdEdit_Click_Err:
    ' Record is locked
    If Err.Number = 3260 Then
    MsgBox Err.Description
    Else
    MsgBox Err.Number & " " & Err.Description
    End If
    Resume cmdEdit_Click_Exit


    Thanks
    le.nhan@web.de

    I believe that the RecordLocks property only works with Forms that have fields bound to the database
    through a Recordset. It won't work with DAO.

    Access 97, Jet/DAO (up to version 3.5) provides locking on 2K page boundaries and not individual
    rows. The closest you can come to a solution using the provided DAO methods is via the LockEdits
    property.

    If you're using Access 2000/Jet 4.0, row-level locking is supported by default, but others users are
    not notified when a row is locked by user.


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center