I have hit a snag with my code and need some advice here.
Problem: I have a form for which the Access level needs to change dynamically, while the document is open, as it gets moved up through the “approval” levels. I am trying to control this using an Authors field on the form. The form starts with Person A in the Authors field, giving them the right to edit and “approve” the document. When they click the “Update and Save” button, the code changes the name in the Authors field to the next level, ie Person B. The problem is that once this is done, Person A can no longer save the form to record the fact that they have changed the name in the field. It is a logical Catch 22 - I can’t change the field after the save because the change won’t get saved and I can’t change it before the save because then they don’t have the authority to make the change.
I thought I had discovered the answer with the GrantAccess method. I have tried to pick up Person A’s name and use the GrantAccess method to give him the authority to make the change while the code is running, but once finished, they cannot make further changes to the form.
However, this method doesn’t appear to work - the code runs fine and looks like it should work ok, but Person A still can’t save the document. I have searched this forum and from one of the answers in here, it appears that the GrantAccess method will only work if the person running the code has the authority to change the ACL. However, if the person had Manager rights, I wouldn’t need the code in the first place!!
The Help does not mention anything about the user needing this level of authority, and the examples provided imply that it can be used to do what I am attempting to do. Therefore, I can only assume that I am not understanding the GrantAccess method correctly.
I need to temporarily grant Editor level access to the user running the code for the duration of the routine. Can anyone tell me where my thinking has taken a wrong turn and how this method works? Or suggest an alternative approach?
PS: Thanks to Stan for his prompt reply to my last question - I sure hope someone can come through for me on this one as quickly fingers crossed