Locking edits on a form

  • Thread starter Thread starter SML
  • Start date Start date
S

SML

Hello!

I have a form which I would like to default open as non-
editable. I would also like to have a text box (or other
method) so that a password could be entered to unlock the
form so that edits could be done.

I'm not looking for a high level of security, just a very
simple protection against casual editing mistakes when
looking up information.

Can you point me in the direction of the easist way to
accomplish this task?

Many TIA.
 
SML said:
I have a form which I would like to default open as non-
editable. I would also like to have a text box (or other
method) so that a password could be entered to unlock the
form so that edits could be done.

I'm not looking for a high level of security, just a very
simple protection against casual editing mistakes when
looking up information.


Set the form's AllowEdits, AllowAdditions and AllowDeletions
properties to permit or deny changes.

You can use the InputBox function in the code behind the
button to prompt the user form an input string. Really
wimpy security, but that's what you said you wanted.
 
I have a form which I would like to default open as non-
Set the form's AllowEdits, AllowAdditions and AllowDeletions
properties to permit or deny changes.

You can use the InputBox function in the code behind the
button to prompt the user form an input string. Really
wimpy security, but that's what you said you wanted.

Ah, thank you, and really wimpy security is fine for this
purpose. So if the input string matches the password
string, I would then set the AllowEdits property to yes?
And to carry over the simple editing protection for each
form, on the forms current event I would reset the
AllowEdits property to no?

The only problem encountered is that I also have a combo
box which jumped to a specific record and when I set the
AllowEdits property to no and the combo box no longer
works. Is is possible to exempt a single control?

Again, many TIA
 
SML said:
Ah, thank you, and really wimpy security is fine for this
purpose. So if the input string matches the password
string, I would then set the AllowEdits property to yes?
And to carry over the simple editing protection for each
form, on the forms current event I would reset the
AllowEdits property to no?

The only problem encountered is that I also have a combo
box which jumped to a specific record and when I set the
AllowEdits property to no and the combo box no longer
works. Is is possible to exempt a single control?


Afraid not. You can however, set some control's Locked
property instead. If you set the Tag property of the
controls you want to lock to some string such as "Allow",
then you can use a procedure like this to lock/unlock the
tagged controls:

Sub SetLocks(OnOff As Boolean)
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag = "Allow" Then
ctl.Locked = OnOff
End If
Next ctl
Set ctl = Nothing
End Sub
 
Back
Top