Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LL_GetObjectRights gives error and vb application closes abruptly

Status
Not open for further replies.

LivelinkDotnet

Programmer
Jul 5, 2010
18
0
0
IN
We have to remove permissions of objects , when run application first it works ok but when it picks up second , the application closes abruptly
when we have debug application stops at fuction
LL_GetObjectRights

we think there might be some memory not being relased

Please help

 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top