Read only Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

Is there a simple way to make a form read only but the ability to some how
put in a paasword to make it editable? I only user to have read only access
but I need for a couple of people to have full access.

Thanks!!
 
You could lock each control on the form except for an "Edit" command button,
which when clicked would unlock each control. You can loop through the
controls on the form by using the Controls collection, and skip your edit
button by checking the ControlType and Name properties. Something like:

Sub LockControls(blnLock as Boolean)
Dim ctl As Control
For Each ctl In Me.Controls
If (ctl.ControlType <> acCommandButton) Or ((ctl.ControlType =
acCommandButton) And (ctl.Name <> "cmdEdit")) Then
ctl.Locked = blnLock
End If
Next ctl
End Sub

In the click event of the edit button you could prompt for a password before
calling LockControls(False).

Carl Rapson
 
Back
Top