Public Function RemovePermissions(ByVal lSession As Long, ByVal DocVolID As Long, ByVal DocID As Long) As Boolean
On Error GoTo Err_RemovePermissions
Dim lError As Long
Dim lRightsRec As Long
Dim lRecCount As Long
Dim IndexLoop As Long
Dim lValue As Long
Dim TempUserID As Long
Dim Permissions As Long
Dim lstatus As Long
lstatus = LL_ValueAlloc(lRightsRec)
lstatus = LL_ValueAlloc(lValue)
lError = LL_GetObjectRights(lSession, DocVolID, DocID, lRightsRec)
lError = LL_ValueGetLength(lRightsRec, lRecCount)
For IndexLoop = 0 To lRecCount - 1
lError = LL_ValueGetIndexValue(lRightsRec, IndexLoop, lValue)
If lError <> LL_OK Then
GoTo Err_RemovePermissions
End If
lError = LL_RecordGetInteger(lValue, "RIGHTID", TempUserID)
lError = LL_RecordGetInteger(lValue, "PERMISSIONS", Permissions)
If lError <> LL_OK Then
GoTo Err_RemovePermissions
End If
If TempUserID > 0 Then
lError = LL_SetObjectRight(lSession, DocVolID, DocID, LL_RIGHT_DELETE, TempUserID, Permissions, 1)
End If
If lError <> LL_OK Then
'Call objDataServices.WriteToLogFile("ERROR: " & Err.Number & " " & Err.Description, "Remove Permissions ")
GoTo Err_RemovePermissions
End If
Next IndexLoop
If lError = LL_OK Then
RemovePermissions = True
Else
RemovePermissions = False
End If
Exit_RemovePermissions:
LL_ValueFree lRightsRec
LL_ValueFree lValue
Exit Function
Err_RemovePermissions:
RemovePermissions = False
GoTo Exit_RemovePermissions
End Function
We call this function to remove permssions of objects on form we enter number of objects , so when we enter suppose count 5 it process well , and after completing 5 records when we again enter next count suppose 5 and click on start application shows Visual basic has encoutered error and need to be closed
Please help us
Thanks in Advance