Edit & Add buttons

  • Thread starter Thread starter johnny
  • Start date Start date
J

johnny

I have a data entry form that I want to be able to pull-up
to either add or edit existing records. Is there anyway I
can have the form have an edit button that once clicked
will allow you to change fields that already exist in the
table. If the button is not clicked it is not possible to
edit the existing information? I have the add button
which takes you to an empty form and allows you to add the
information to the end of the table. I don't want the
user to be able to accidently change existing entries when
they open the form, which is how it is currently set up.
I only want them to be able to change existing data when
clicking the edit button. THANK YOU for any help that you
can provide.

Thanks again!!!!!
 
Set the form's AllowEdits property to No.

Set the command button's Click event procedure to something like this:

Private Sub cmdToggleEdit_Click()
If Me.Dirty Then 'Save any changes first.
Me.Dirty = False
End If
Me.AllowEdits = Not Me.AllowEdits
Me.cmdToggleEdit.Caption = IIf(Me.AllowEdits, "&Lock", "Un&lock")
End Sub
 
Back
Top