<< So it seems that information is available, must be in the LDB file
- does anyone know how to get at it?>>
The information is not available in the LDB file. The LDB file is simply a list of users currently in the database and in all cases, that may not be true.
To really understand who is in the DB, you must look at the user locks placed on the .LDB file.
<<3218 is a record locking error, perhaps 3188 as well. I can trap the error, but I don't know how to identify who is locking the record. >>
The way to do it is to parse the message that Access generates. Below is the code to do that.
Jim.
Function IsLocked(rs As Recordset, UserName As String, MachineName As
String)
' Accepts: a recordset and two string variables ' Purpose: determines if the current record in the recordset is locked,
' and if so who has it locked.
' Returns: True if current record is locked (and sets UserName
' and MachineName to the user with the lock). False if the
' record isn't locked.
' From: Building Applications Chapter 12
Dim ErrorString As String
Dim MachineNameStart As Integer
IsLocked = False
On Error GoTo IsLockedError
rs.Edit 'Try to edit the current record in the
recordset.
rs.MoveNext
rs.MovePrevious
Exit Function 'No error, so return False.
IsLockedError:
If Err = 3260 Then 'Record is locked -- parse error string.
ErrorString = Error$
UserName = Mid$(ErrorString, 44, InStr(44, ErrorString, "'") - 44)
If UserName = "" Then UserName = "(unknown)"
MachineNameStart = InStr(43, ErrorString, " on machine ") + 13
MachineName = Mid$(ErrorString, MachineNameStart, Len(ErrorString) - MachineNameStart - 1)
If MachineName = "" Then MachineName = "(unknown)"
IsLocked = True
End If
Exit Function
End Function