M
Mourad
I'm calling LDBUser_GetUsers() function (provided by Microsoft as a
part of JetUtils).
Then when referencing the first element (index 0) I'm getting the
error "Subscript out of range"
This code is a sample fromMicrosoft website:
ReDim lpszUserBuffer(1) As String
Dim intLooper As Integer
Dim Cusers As Long
On Error GoTo Err_GetUsers
strUsers = ""
StrDbPath = "abx.mdb"
' Set Cusers to the number of computers currently connected
' to the database. Insert computer information into the
' lpszUserBuffer array.
' Arguments of LdbUser_Get Users:
' 1 = All users who have logged in since the LDB file was
' created
' 2 = Only users who are currently logged in
' 4 = Only users who are causing the database file to be
' corrupted
' 8 = Just return the count of users
Cusers = LDBUser_GetUsers(lpszUserBuffer(), StrDbPath, 2)
' Print possible errors returned by the function.
Select Case Cusers
Case -1 ' when it is open
by Access 2.0
strUsers = "Can't open the LDB file for " & DBCode
strUsers = strUsers & ". File may be locked by one or more
Access 2.0 users "
Case -2
strUsers = "No user connected to " & DBCode
Case -3
strUsers = "Can't Create an Array"
Case -4
strUsers = "Can't redimension array"
Case -5
strUsers = "Invalid argument passed"
Case -6
strUsers = "Memory allocation error"
Case -7
strUsers = "Bad index for " & DBCode
Case -8
strUsers = "Out of memory"
Case -9
strUsers = "Invalid Argument"
Case -10
strUsers = "LDB is suspected as corrupted for " & DBCode
Case -11
strUsers = "Invalid argument"
Case -12
strUsers = "Unable to read MDB file for " & DBCode
Case -13
strUsers = "Can't open the MDB file for " & DBCode
Case -14
strUsers = "Can't find the LDB file for " & DBCode
Cusers = 0
End Select
if Cusers > 0 Then
For intLooper = 0 To Cusers - 1
Debug.Print lpszUserBuffer(intLooper) '<<<< Gives error
"Subscript out of range"
Next
end if
Thanks for reading,
Mourad
part of JetUtils).
Then when referencing the first element (index 0) I'm getting the
error "Subscript out of range"
This code is a sample fromMicrosoft website:
ReDim lpszUserBuffer(1) As String
Dim intLooper As Integer
Dim Cusers As Long
On Error GoTo Err_GetUsers
strUsers = ""
StrDbPath = "abx.mdb"
' Set Cusers to the number of computers currently connected
' to the database. Insert computer information into the
' lpszUserBuffer array.
' Arguments of LdbUser_Get Users:
' 1 = All users who have logged in since the LDB file was
' created
' 2 = Only users who are currently logged in
' 4 = Only users who are causing the database file to be
' corrupted
' 8 = Just return the count of users
Cusers = LDBUser_GetUsers(lpszUserBuffer(), StrDbPath, 2)
' Print possible errors returned by the function.
Select Case Cusers
Case -1 ' when it is open
by Access 2.0
strUsers = "Can't open the LDB file for " & DBCode
strUsers = strUsers & ". File may be locked by one or more
Access 2.0 users "
Case -2
strUsers = "No user connected to " & DBCode
Case -3
strUsers = "Can't Create an Array"
Case -4
strUsers = "Can't redimension array"
Case -5
strUsers = "Invalid argument passed"
Case -6
strUsers = "Memory allocation error"
Case -7
strUsers = "Bad index for " & DBCode
Case -8
strUsers = "Out of memory"
Case -9
strUsers = "Invalid Argument"
Case -10
strUsers = "LDB is suspected as corrupted for " & DBCode
Case -11
strUsers = "Invalid argument"
Case -12
strUsers = "Unable to read MDB file for " & DBCode
Case -13
strUsers = "Can't open the MDB file for " & DBCode
Case -14
strUsers = "Can't find the LDB file for " & DBCode
Cusers = 0
End Select
if Cusers > 0 Then
For intLooper = 0 To Cusers - 1
Debug.Print lpszUserBuffer(intLooper) '<<<< Gives error
"Subscript out of range"
Next
end if
Thanks for reading,
Mourad