I have a database with a group of master forms and then sub forms created from a master form. the master form is called “Master Form” and sub form is called “Sub Form”. they’re tied together from “DetailKey” which is basically just the time that master form was created. Whenever a sub form is created, it’s given this same “detailkey” time, so the sub form knows that it’s attached to the master form.
I’ve been asked to give the forms a “locking” function to where once it’s locked, you can’t edit the master form or the sub forms.
I have been trying to write an agent called “Lock” that will use the detail key from the master form and then fill in a field called “LOCKED” on the sub forms with the word “LOCK”. How can I create an agent that uses the first page’s detail key to search all of the forms in the database that have the same detail key and just perform this simple action?
We do a similar thing w/ sub forms- while I don’t like the application- it is successful- we create editable subforms and subforms where the fields are simple computed- based on a user’s access role they either get the subforms w/ the computed fields (they can’t edit obviously) or the subform with the editable fields- if you did a similar thing- based on time- I think it would work. We use ours for an ISO certification thing- locks in the values.Tom
Not sure why you would use the time fields when Notes already gives you the $Ref field on any subform which is the UNID of the parent document. as for the Locking process the Computed Subform method is probably the easiest. Though you could add some code to the QueryOpen and QueryModeChange that would not allow the user to change it to edit mode. This way you can be pretty selective and allow the Mode Change if you belong to a specific role or if a field on the form contains a specific value. From a maintenance perspective I would prefer the Mode Change because then there is just the one subform and you don’t have to make design changes in two places. But there are always more than one way to ‘skin the cat’ and everyone will have their own take on it.