Editable Form to Non-editable

  • Thread starter Thread starter DSmith
  • Start date Start date
D

DSmith

I've had a request to make a form non-editable but with the ability to
become editable. The owner is worried that data will be changed unknowingly.
So my question is what is the best way to achieve this?

1. Can I use a toggle command button for a form to achieve this end?
2. Would it be better to just have two forms-one editable the other not.
3. Or would using the MS Workgroup Administrator the way to go?
4. Or is there a better way not mentioned above?

I am in the process of splitting this database into a FE and BE and then
completely rebuilding the FE. But in the meantime, this feature has been
requested.

Any help is greatly appreciated. Thanks in advance.
 
DSmith said:
I've had a request to make a form non-editable but with the ability to
become editable. The owner is worried that data will be changed
unknowingly. So my question is what is the best way to achieve this?

1. Can I use a toggle command button for a form to achieve this end?
2. Would it be better to just have two forms-one editable the other
not.
3. Or would using the MS Workgroup Administrator the way to go?
4. Or is there a better way not mentioned above?

I am in the process of splitting this database into a FE and BE and
then completely rebuilding the FE. But in the meantime, this feature
has been requested.

Any help is greatly appreciated. Thanks in advance.

I'd use a command button with code to toggle the form's AllowEdits,
AllowAdditions, and AllowDeletions properties. Something like

'----- start of example code -----
Private Sub cmdLockUnlock_Click()

If Me.AllowEdits Then
' Editing is currently enabled, so turn it off,
' saving the record first if necessary.
If Me.Dirty Then Me.Dirty = False
Me.AllowEdits = False
Me.AllowAdditions = False
Me.AllowDeletions = False
Me.cmdLockUnlock.Caption = "Unlock"
Else
' Editing is currently disabled, so turn it on.
Me.AllowEdits = True
Me.AllowAdditions = True
Me.AllowDeletions = True
Me.cmdLockUnlock.Caption = "Lock"
End If

End Sub
'----- end of example code -----

However, if you want to allow certain individuals to edit freely, but
not others, then implementing user-level (workgroup) security is the way
to go.
 
I've tried making the toggle button using the code given. It works except
that it won't toggle. I can depress it once and only once. I have to
completely get out of the form to reset the toggle button.

Also this form is very complicated with a subform and several command
buttons leading to other linked forms. Will I need to put a toggle on every
subform or is there a way to link the toggle button to all the forms so that
they are all either editable or not editable?

Thanks in advance.
 
Back
Top