- Give each record a serial ID number field to uniquely identify each record.
- Use this expression and Manage | Security (Manage | Accounts & Privileges in older versions ):
- Items::gLockID = Items::ID
- To lock records against editing.
- Where gLockId is a global number field that you set to empty in your start up script.
- To "unlock" a record, use a script that changes the value of gLockID to be the same as Items::ID
That simplifies things quite a bit in a single user environment and quite an elegant solution. But suppose I am editing an unlocked record where gLockID=zzID and another user comes along at the same time and unlocks a different record? It seems to me that gLockID now contains a value different from the zzID of the record that I am editing, and now I am locked out. Are globals unique to the user? Would this solution work in multi-user environments?
The key here is that each user in a multi-user environment gets their own copy of any global fields. Thus user 1 can store 3456 in gLockID and User 2 can store 2145 in gLockID at exactly the same time.
More on global fields: http://help.filemaker.com/app/answers/detail/a_id/3604/kw/global%20fields%20network
Sweet! A kudo to you...wait, what happened to the kudos?
If any readers need a more detailed description of what went on here, I'll be glad to tell how I implemented Phil's method.