Lock data already entered

  • Thread starter Thread starter KPGUY
  • Start date Start date
K

KPGUY

How can I lock entered data. I don't want anyone to be
able to change the data in the form after it has already
been entered (on a consistent basis). Also, I do want it
to allow me to make edits if needed, but not anyone else.
Right now, anyone can go back to an old record and change
the information. Should I try locking the table data?
 
There are different ways to doing this. One easy way is to create two
separate forms, one for data entry and one for viewing data. You can change
a form's Data Entry property to Yes to only allow for data input. Change the
Allow Edits, Allow Deletions, and Allow Addtions properties to No for the
second form to prevent changes.
 
In a similar situation I used Me.AllowEdits = False (or =
True). The way I did it was to use the form's open event
to open at a new record (Me.Recordset.AddNew). I also
added Me.AllowEdits = True and code to make a command
button (cmdAllowEdits) invisible. This way the user opens
the form to an "unlocked" record.
I used command buttons on the form to navigate to next and
previous records. Each command button includes
Me.AllowEdits = False within its click event. I used the
form's lost focus event to make cmdAllowEdits visible.
cmdAllowEdits could open a pop-up form with a text box for
entering a password. The correct password could close the
pop-up form and set Me.AllowEdits = True. A command
button to start a new record sets Me.AllowEdits = True,
and Me.cmdAllowEdits.Visible = False. Anytime the user
adds a record, the command button to edit is invisible,
since it is unnecessary. Anytime the record is locked,
the command button is visible. This doesn't protect
subform records, at least not the way I set it up.
This method is not all that secure, since it allows entry
to the database through the back door to knowledgeable
users, but it is fairly convenient.
You could use the allow additions property as outlined in
Sal's reply, but bear in mind that all changes would need
to be reflected in both forms, and that you would need a
way to get to the editable form from within the database.
If you can do that, a knowledgeable user could also.
 
Back
Top