Lock user from editing the entry form

  • Thread starter Thread starter suzie
  • Start date Start date
S

suzie

I have been asked from my friend on how to prevent users
from editing record once it has been keyed into the system.

I've tried to solve this problem but cant. Once we block
the field, the next entry cannot be made to that field. I
can only block that field if all records have been
entered. Then user cannot modify from the entry form.

Is there any way we can block certain fields if users have
key in and cannot ammend the data?
 
I have been asked from my friend on how to prevent users
from editing record once it has been keyed into the system.

I've tried to solve this problem but cant. Once we block
the field, the next entry cannot be made to that field. I
can only block that field if all records have been
entered. Then user cannot modify from the entry form.

Is there any way we can block certain fields if users have
key in and cannot ammend the data?

One simple way is to set the DataEntry property of the form to True.
This will let you enter new records (and edit any that you've entered
during that session), but will not allow you to edit or even view
previously entered records.

One could write some VBA to toggle the AllowEdits property of the form
based on whether you're on the new record or not, but it wouldn't be
trivial.
 
Thanks john...but this will not allow me to view the
existing record. I need to view that record it just that
we need to lock/block certain field only.
e.g In Quotation Form there's a field named Price. We want
to block user from modifying/editing the price that has
been entered. Other than that field is allow for editing.

Thank you
 
e.g In Quotation Form there's a field named Price. We want
to block user from modifying/editing the price that has
been entered. Other than that field is allow for editing.

Ok... use the Form's Current event to selectively enable and disable
the Price control:

Private Sub Form_Current()
Me.Price.Enabled = (Me.NewRecord)
End Sub
 
On the Form Current Event
Assuming you set the Controls Tag to "Locked" for the controls you want
Locked...


Dim C As Access.Control
For Each C in Me.Controls
If TypeOf C Is TextBox Or TypeOf C is OptionGroup Then 'CheckBox,
Combobox ... or add on error resume next as error handler and skip this if
If Instr(C.Tag,"Locked")>0 Then ' Must Check for Null in Access 2.0,
but ...
C.Locked = Not IsNull(C.Value)
End If
End If
Next

HTH

Pieter
 
Back
Top