Protect data entered in fields in form

  • Thread starter Thread starter SBecker
  • Start date Start date
S

SBecker

I have a database that contains loan numbers and issues/incidents associated
with the loan. Multiple users enter data in the form. Can I protect certain
fields once data is entered, prompting a pop up to confirm with the user that
they want to make the change and/or lock specific fields completely but still
allow data entry?

Suggestions?
 
A control can be locked/unlocked at any time in VBA code.

Me.ControlName.locked = True

You'll just need to determine your business rules, and a trigger to
lock/unlock the fields.
 
I think there are several ways to accomplish this, depending on your form.
You could set the form's Allow Edits and Allow Deletions properties to No.
However, this would affect all controls (even unbound ones) on your form.

If you want to lock individual controls after they are updated, you might
want to search the Forms section of this discussion group for "locking
controls" because there's lots of good advice here.

The simplest approach I've found is to put 'LockMe' in the Tag property of
the controls you want to be read only, then put this in the form's OnCurrent
Event:

Dim ctrl As Control

For Each ctrl In Me.Controls
If ctrl.Tag = "LockMe" Then
ctrl.Locked = Not Me.NewRecord
ctrl.Enabled = Me.NewRecord
End If
Next ctrl


Hope that helps!
 
Back
Top