Read-Only vs Edit Data On Form Via Button

P

Paputxi

I have a form with many fields displayed. I want the data to be initially
displayed as read-only. If the user wants to make updates then (s)he has to
click an Edit button that would then allow all the fields to be updatable.
Any suggestions on how to accomplish this? Thanks in advance.
 
D

Douglas J. Steele

Initialize the form's AllowEdits, AllowDeletions and AllowAdditions
properties to False.

In the button's Click event, change those properties back.

You might consider using a toggle button, rather than a simple command
button. To allow edits when the button is depressed, and not when it's
raised, try something like:

Private Sub MyToggleButton_Click()

Me.AllowAdditions = Me.MyToggleButton
Me.AllowDeletions = Me.MyToggleButton
Me.AllowEdits = Me.MyToggleButton

End Sub

In the form's Load event, use:

Private Sub Form_Load()

Me.MyToggleButton = False
Me.AllowAdditions = False
Me.AllowDeletions = False
Me.AllowEdits = False

End Sub
 
Top