Protect data entered in fields in form

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?
 
S

S.Clark

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.
 
C

Cathleen

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top