In the Inspector, on the Data tab, there's a section labeled behavior where you can block access to a field for all users by clearing at least the "browse" check box.
In your triggered script, you can use go to field or go to object to move the cursor out of the field to a different objet if you want it accessible to some users and not others.
Thanks Phil. I also discovered that if OnObjectEnter trigger script does a Commit and Exit False the field is left unentered.
Similarly, Ken, I prefer script called TRG: noFieldEntry [ flag ] with:
If [ Get ( scriptParameter ) ]
Go To Object [ “Dummy” ]
Why? Because I don’t want to commit the record. I also want generic script which can work for all fields; I simply set the Boolean test as the parameter on each field. If true, it disallows entry. In this way, you don’t have to turn off entry to the field and then script when it can be entered.
What is the Dummy? I chose an object which always exists on my layouts – an “I declare variables” text object. It can be a company logo, a header line … anything static.
Keep in mind that, if the control should work on the field no matter the layout and the only TRUE way to protect data, is by using Security (what used to be called Accounts & Privileges).