LDB Viewer with a Password Protected BE

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to see the users logged into a database and have the LDB Viewer, but
my back end is password protected to prevent users from opening it directly.
But this also causes the LDB viewer to return an error "Password Incorrect".
Anybody know of a way around this with specific code if necessary?

Thanks!
 
Rather than the LDB Viewer, why not try the msldbusr.dll? You call it's
methods from your VBA code. I'm using it successfully with a password
protected A97 BE. Here's the code (partial, anyway):

Declare Function LDBUser_GetUsers Lib "MSLDBUSR.DLL" (lpszUserBuffer() As
String, ByVal lpszFilename As String, ByVal nOptions As Long) As Integer
Declare Function LDBUser_GetError Lib "MSLDBUSR.DLL" (ByVal nErrorNo As
Long) As String

Public Const OptAllLDBUsers = &H1
Public Const OptLDBLoggedUsers = &H2
Public Const OptLDBCorruptUsers = &H4
Public Const OptLDBUserCount = &H8
Public Const OptLDBUserAuthor = &HB0B

Dim lRet As Long
Dim strUsers() As String

lRet = LDBUser_GetUsers(strUsers, strDBFile, OptLDBLoggedUsers)
If lRet < 0 Then
If lRet <> -2 And lRet <> -14 Then
strError = LDBUser_GetError(lRet)
MsgBox strError, vbExclamation
LogError Me.Name, lRet, strError, "MSLDBUSR.DLL"
Exit Function
End If
ElseIf lRet > 0 Then
'Users are still connected
strMsg = lRet & " users are still connected!" & vbCrLf & _
"Please make sure these users are logged off:" & vbCrLf
For L = LBound(strUsers) To UBound(strUsers)
strMsg = strMsg & strUsers(L) & vbCrLf
Next
strMsg = strMsg & "Click Retry when ready or Cancel to abort."
iResp = MsgBox(strMsg, vbRetryCancel Or vbInformation)
If iResp = vbRetry Then
GoTo Check_Again
Else
Exit Function
End If
End If
 
Back
Top