Can I protect certain fields in a form in Access for specific user

A

Abbe9508

I am setting up a database in which customers will enter their feedback and
in the same form I have a section "for office use only" that will be used by
employees to tabulate information from the upper part of the form. I am
wanting to protect the bottom by password so that only a few trained people
can enter this information. How do I do this? (I already know that I can
protect an entire form, but what about parts of the form?)
 
J

Jason Rice

One way that you could do this is to disable all of the fields that you want
to protect in the form's design view. Then add a method for the user to
enter the password (i.e. a text box on the current form, a command button
that runs a password verification, etc). If the password is correct, then
you can just enable the fields.

field1.enabled=true
field2.enabled=true

Depending on the names you are using for your fields you could also set up a
loop to enable the fields that you need to protect.

If the fields contain numbers to differentiate them:
For i = 1 to 2
me.controls("field" & i).enabled=true
next i

If the fields have a common string in the names:
Dim ctrl as Control
For Each ctrl In Me.Controls
If ctrl.Name Like "*protected*" Then Me.Controls(ctrl.Name).Enabled =
True
Next ctrl
 

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