Hi,
When testing for equality use a double ==.
Paul has an example of locking fields within a container (http://forums.adobe.com/message/2134982#2134982). It loops through all objects in a subform and locks them in turn.
Look at Paul's form, you will see a script object called "myScriptObject" in the hierarchy. There are a couple of ways to copy this into your form. The easiest is to create a script object in your form (right click on "form1" in the hierarchy and select "insert script object") and then name it "myScriptObject" or whatever name you want. Then copy all of Paul's function into your script object.
The function starts with:
function LockAllFields(myParentObject)
{
...
} // ends with closing bracket
LockAllFields = name of function
myParentObject = the name of the object that you specify when you call the function, e.g. "form1.Data" below.
You could have two functions in one script object. One would be Paul's to lock the objects and the second would be an adapted one to unlock the objects (change all "readOnly" to "open").
Your if statement would then look like in javascript:
if (form1.Data.textField1.access == "open") // test an object in Data subform
{
myScriptObject.LockAllFields(form1.Data);
}
else
{
myScriptObject.UnlockAllFields(form1.Data);
}
Give it a try,
N.