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?
doe5Asked:
Who is Participating?
 
peter57rCommented:
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
else
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.
0
 
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
   me.controlname1.locked=true
end if

end sub
0
 
doe5Author Commented:
Thank you both.
0
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.