Results 1 to 4 of 4
  1. #1
    EddieN1 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    313

    How to Determine Who Has a SQL Server Record Locked


    We're running SQL Server 2012. On occasion, an operator will lock a record and when another operator tries to update the same record, the system throws a Runtime Error. We can't find out who has the record locked and have to wait overnight before the record gets unlocked. Is there a way to determine, using VBA, to determine who has it locked. Thanks, Eddie

  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,892
    I have no idea if what you want is possible.

    What you can do is track who might be interacting with the db. When user opens the frontend, create a login record (I just update a field in Users table) for that user. When they close the db, create a logout record (I just update same field setting it to null).

    I read something about avoiding most occurrences of error by setting LOCK MODE to "WAIT". Since I don't use SQLServer, no idea how nor if that would really accomplish anything.

    Here is how one developer solved issue https://www.sqlservercentral.com/For...930-131-1.aspx
    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.

  3. #3
    EddieN1 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    313
    What I'm looking for is when a record locked condition is encountered, I'd like to issue a SQL Server function that will return the user ID of the operator who holds the record lock. Any other ideas?

  4. #4
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,041
    Hi,

    if traceon 1204 or 1222 is turned on you can find the deadlocks in the SQL server logs in the management studio. You can turn these on with the SQL commands
    DBCC traceon (1222, -1)
    or
    DBCC traceon(1204, -1)

    In the SQl server log files you'll find the spid that causes the deadlock. Use sp_who to get the login name.

    Kind regards
    NoellaG

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

Similar Threads

  1. How to determine if a record is the first in its set
    By ExtremeNovice in forum Queries
    Replies: 2
    Last Post: 03-03-2017, 03:18 PM
  2. Can't update record, currently locked
    By clancy76 in forum Access
    Replies: 5
    Last Post: 04-16-2015, 10:20 AM
  3. Replies: 3
    Last Post: 05-13-2012, 07:31 AM
  4. Form locked - won't allow new record
    By mhart in forum Forms
    Replies: 4
    Last Post: 02-22-2012, 02:46 AM
  5. is there is a way to make a record locked
    By Nokia N93 in forum Access
    Replies: 5
    Last Post: 05-11-2011, 02:47 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