Help with GrantAccess method

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

Subject: Help with GrantAccess method

Hi Sue,

Continue using the Authors field. List all the users name in the Authors field.

You maintain one StatusNumber field where you assign number for each status and while moving the document from one level to the next change the value inthe StatusNumber field along with Status field.

While any user is trying to edit the document, check in QueryChangeMode event, allow access accordingly.

I hope this will help you to resolve your issue.

Let me know if you need any further help.

Regards,

Kash.

Subject: Help with GrantAccess method

Unless you’re dong multiple saves, what your trying should workStart wth a clean form and try again

Set your author field to e.g. fred

Add a button that changes the author=field to e.g. jim the saves it

When fred edits the doc, it’s Ok because he’s in the authorfield

When heclicks the button, he should be able to save it, as the field isn’t saved as Jim yet

After saving, only jim should be able to edit it