Results 1 to 2 of 2
  1. #1
    JMR is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    17

    Error 91

    I have the code below that is supposed to check if a record is locked by any other user, and if so, pop up a warning message. The oncurrent event runs this single line: DisplayLockStatus. It seems to work fine when User1 is in a record and User2 tries to view that same record, but the problem is that every time any user opens the form, it pops up the message even if no one else has access open at all. Split DB. Any help is appreciated!




    The code for the sub is:

    Private Sub DisplayLockStatus()
    Dim frm As Form
    Dim rst As DAO.Recordset
    On Error Resume Next
    ' We clone the form recordset and sync up to the form current record using the bookmark
    Set rst = frm.RecordsetClone
    rst.Bookmark = frm.Bookmark

    ' If the current record is locked, then editing the recordset will produce an error that we will trap
    rst.Edit


    If Err.Number <> 0 Then
    MsgBox ("WARNING! This record is currently being edited by another user and is locked. To make any changes to this record you will need to have exclusive access!")
    End If
    rst.Close


    End Sub

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 07-15-2019, 10:20 AM
  2. Replies: 6
    Last Post: 03-17-2016, 02:10 PM
  3. Replies: 3
    Last Post: 01-23-2014, 07:49 AM
  4. Replies: 0
    Last Post: 07-16-2012, 05:42 AM
  5. Replies: 6
    Last Post: 05-30-2012, 12:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums