nexus,<br>
You can do the following, on whichever event you want to track the field, ie, Open, AfterUpdate of that field, etc.<br>
If me.checkedfield = somevalue then<br>
For i = 0 to me.fields.count -1<br>
If Typeof me(i) is TextBox Then<br>
me(i).locked = true 'Or Enabled = false, if you want that effect)<br>
ElseIf Typeof Me(i) is CommandButton then<br>
me(i).enabled = false<br>
End If<br>
next I<br>
Else<br>
For i = 0 to me.fields.count -1<br>
If Typeof me(i) is TextBox Then<br>
me(i).locked = false <br>
ElseId Me(i) is CommandButton then<br>
me(i).enabled = true<br>
End If<br>
next I<br>
End if<br>
<br>
Then, if you have fields you always need enabled, such as an Exit button, then enable them at the bottom of the code, regardless of the fields value<br>
--Jim
Can you just set the form's allowedits property to false, if value = xx?? Put code in the afterupdate property of the field you're basing the decision on or in the onopen propery of the form depending on your timing. Check out the allowedits property example in help if you want to go this route--- <p>jgarnick<br><a href=mailto:jgarnick@aol.com>jgarnick@aol.com</a><br><a href= > </a><br>
Don't forget you may someday need to change the control that indicates the "editability" of the record. You might want to leave that one field editable.
If you want to keep the fields locked when users are just browsing the records, place the code as well into form's OnCurrent property. It runs every time when user moves between records. OnOpen or OnLoad does the trick only once for the first record.<br>
<br>
Al
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.