Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Private Sub cmdExecute_Click()
Dim varBuffer As Variant
Dim intReturn As Integer
Dim intI As Integer
Dim strTemp As String
Dim strLDB As String
Dim lngOptions As Long
Me![txtResults] = ""
If Not IsNull(Me![Combo27]) Then
strLDB = Me![Combo27]
lngOptions = 2
intReturn = GetComputerNames(strLDB, lngOptions, varBuffer)
If IsArray(varBuffer) Then
For intI = LBound(varBuffer) To UBound(varBuffer)
strTemp = strTemp & varBuffer(intI) & " "
Next intI
strTemp = strTemp & vbCrLf
strTemp = strTemp & "# of Users = " & intReturn
Else
strTemp = varBuffer & vbCrLf & vbCrLf
strTemp = strTemp & "Error Code = " & intReturn
End If
Me![txtResults] = strTemp
End If
End Sub
Option Compare Database
Option Explicit
'*************************************************************
'This module is based in part on a VB4 sample that is referenced
'by the white paper "Understanding Jet Locking". Instructions
'for this and other utilities can be referenced in that paper
'MSLdbUsr.DLL was written and developed by
'Kevin Collins (73760.1047@compuserve.com)
'and Bob Delavan
'This Access for Windows 95 sample was written and developed
'by Michael Kaplan (102363.1726@compuserve.com, or also at
'MichaelK_TSI@msn.com).
'*************************************************************
'You use the following constants with the LDBUser_GetUsers
'function's "nOptions" parameter below.
Public Const OptAllLDBUsers = &H1
Public Const OptLDBLoggedUsers = &H2
Public Const OptLDBCorruptUsers = &H4
Public Const OptLDBUserCount = &H8
Public Const OptLDBUserAuthor = &HB0B
'Takes a string array buffer, a currently existing database
'filename, and one of the above constants as its parameters.
'When successful it will return the number of people in the
'database or "0" if there are no people in it. It returns a
'negative number in case of an error, and you can then use
'LDBUser_GetError to retrieve extended error information.
Declare Function LDBUser_GetUsers Lib "MSLDBUSR.DLL" _
(lpszUserBuffer() As String, ByVal lpszFilename As String, _
ByVal nOptions As Long) As Integer
'Takes the error code returned by another MSLDBUSR.DLL function
'call and returns the error text associated with that error.
Declare Function LDBUser_GetError Lib "MSLDBUSR.DLL" _
(ByVal nErrorNo As Long) As String _
Function GetComputerNames(ByVal strMDB As String, _
ByVal lngOptions As Long, _
ByRef varArray As Variant) _
As Integer
'In:
' strMDB Name of MDB file (including MDB file type suffix)
' lngOptions The value of the OptMDB constant to be used.
' varArray A variant that will hold either the error code
' and error message OR the array of user names that
' was requested.
'Out:
' On Success The number of users (0-255) that meet the
' specified criteria.
' On Failure The error code. Extended info can be retrieved
' with LDBUser_GetError.
Dim intReturn As Integer
ReDim astrBuffer(1) As String
strMDB = MDBName(strMDB)
intReturn = LDBUser_GetUsers(astrBuffer, strMDB, lngOptions)
GetComputerNames = intReturn
If intReturn < 0 Then
varArray = LDBUser_GetError(intReturn)
Else
varArray = astrBuffer()
End If
End Function