Authorzied to edit document based on role access

I have a document that required to edit if user has specific to role access. If document field have neuroscience value and user has access to the role then edit otherwise can’t edit.My script below give me error “type mismatch” to line if mgr<>1 then

other error “Variant does not exist an object” to line If uidoc.getfieldtext(“cdp_type”) =“NEUROSCIENCE” And neur <> 1 Then

Dim mgr As Variant, neur As Variant

mgr = Evaluate("@IsMember( ""[Manager]""; @UserRoles) ")

neur= Evaluate("@IsMember( ""[Neur]""; @UserRoles) ")



If mgr <> 1 Then 

	Msgbox "You are not authorized Manager to Edit documents." , 16, "Error"

	Continue = False

End If

esle

If uidoc.getfieldtext("cdp_type") ="NEUROSCIENCE" And neur <> 1 Then 

	Msgbox "You are not authorized to Edit documents." , 16, "Error"

	Continue = False



End if

Exit sub

please advise any help would be grateful.

amp

Subject: array not string/number returned

the evaluate of mgr & neur returns an array:just change to

if mgr(0)<>1 then