View Full Version : lock/unlock


deepbreath
05-24-2001, 04:56 AM
can i put a button on from that helps to lock and unlock the form for viewing or editing data. i.e if i press once it displays view only and one can only view the data, if i press again it asks some password and then displays edit and allow the editing.
is there any other method to accomplish the same.
really appreaciate if some one can help.
thanks

Matthew Snook
05-24-2001, 08:41 AM
I have used the "Locked" and "Enabled" properties of various controls to do something similar. In the "click" event of your button, put

Me!ControlName.Enabled = False
or
Me!ControlName.Locked = True

to lock the named controls, or the opposite to unlock them. If you use just the "enabled" property, then the control will be grayed out.

Somebody posted a method, which I haven't had time to try, of assigning all pertinent controls to a group, then changing the properties within the group. This would shorten the code since you'd only have to enable and lock the group, not each individual control. Worth looking into...

Matt