Prevent Updates and Deletes?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to be able to allow users to input info into a DB using an Access 2003
form, but not be able to change or delete the information once they input it.
If corrections have to be made, they should add add another record so that a
history of changes can be maintained.

Is there a way to prevent people from updating the info?

Thanks!
 
Use one of the fields in the form that always have data in it, unless it a
new record, and in the form Current event you can write

Me.AllowEdits = IsNull(Me.[FieldName])
 
Is a programming solution the only solution?

The first reply seems to only address NULLs. I want to prevent updates from
one value to the next. Thanks!
 
I don't think you quite understood Ofer's solution. What he was saying is
that when you create a new record, the field will be null and you can set
your form's AllowEdits based on that.

Now, I would take a different approach. You can put code like this in the
Current event of the form and it will take care of whether you can enter data
for new records, or only view existing records. It will also require you set
the form's Allow Deletions property to No.

Me.AllowEdits = Me.NewRecord

Simple as that. If you are on a new record, Me.NewRecord will return True
which will, in turn, set the AllowEdits property to True. If you are on an
existing record, Me.NewRecord will return false and editing will not be
allowed.
 
Back
Top