Facing controlled access section problem

I am trying to program to protect one field on the form from being edited by people except they use a programed button to change the content of this field.

I create a controlled access section contained this field and write formula to change the access role.

@If($EditV = “0”; “-nobody-”;“”)

the field $EditV is outside of section to control the status of editable. if it is “0”, the section access is nobody. if it is “1”, everyone can modify section field. the button program write content to section field.

the button program change the $EditV status. and refresh the current document.

the problem is when run this button, it display the field can not be edited. I checked the $EditV, it become “1”, and controlled access section display all users could access this field.

could you please give me some advice to work around it.