Read only Form

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!!
 
C

Carl Rapson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top