Lock field based on another value

MS Access 2000. In my Data Entry form, I would like to lock a field if the user keys in "Pass" in another field.
How can I do that?
Who is Participating?
You have to add code to 2 places.
In the afterupdate event procedure of the 'pass' field you put:

If me.thiscontrolname = 'pass' then
me.othercontrolname.locked = true
me.othercontrolname.locked = false
end if

The same code need to go into the Form_current event procedure so that exiating records have the same rule.
Rey Obrero (Capricorn1)Commented:
in the exit event or afterupdate event or lostfocus event of the control

private sub controlname_afterupdate()

if me.controlname="Pass" then
end if

end sub
doe5Author Commented:
Thank you both.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.