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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ACcess via Author fields - how to set! 1

Status
Not open for further replies.

fishkake

MIS
Feb 11, 2004
130
GB
I have a problem. I want a user to be able to create a document, and then deny that user access to the document as soon as it is saved. The problem I have is that if I call the fieldSetText method to empty the field, I can't save because I'm not an allowable author (which makes sense). Do I need to do this with a scheduled agent? Surely there is a better way...
 
Two solutions :

1) avoid putting the user's name in an Author field
2) use the QuerySave event to remove the name when the document is being saved

In solution 1), you can perfectly well allow a user to create a document without giving that user author access afterwards. Be careful though, because if the user has author access, he will only be able to save it once.

Which means that you will probably get to a scenario where you want the user to be able to save freely until the document is "published", or otherwise declared "finished" by the initial author.
Which brings us to solution 2), in which you check on save what the status of the document is and, if "finished", you remove the author from the field.

Also, note that a document can very well be saved without anything in the Author field(s) at all. In which case, one needs to have at least Editor access to the database to be able to edit it.

Pascal.
 
Thankyou Pascal! Again you save me from the clutches of incompetence... ;-)

"Be careful though, because if the user has author access, he will only be able to save it once." - This was the part that I failed to understand. My QueryClose event contained a source.Save call, which was causing the document to save twice, and the second one obviously failed.

I am now in the process of re-writing this so that I can put it all in the QuerySave event, and only have to save the document once.
 
It is a very bad idea to do call for a save in the QueryClose event. You run great risks of being caught in an infinite loop.

Pascal.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top