How to mark some fields read-only?

M

Me

I have an access form comprising of 3 subforms that in turn are linked to 3
different sql tables.

For some users, I would like them to insert records into just one subform
while the other two subforms are still available for viewing. I am able to do
this, wherein they will get error at the time of saving record. However, I
would like to restrict users from even data entry into the two forms in which
they shouldnt be entering any data. How can it be done without putting a
check for each and every entry on the form?

Imagine you have employee payroll, you can see the employee name, address,
ssn, etc. on top window.
2nd window shows dependents information.
the 3rd window is to enter some comments, users should be able to just add
comments into the 3rd window without making any changes to the 1st two
windows. The 1st two windows should be kinda greyed out. Is it easily doable?

Thanks for your help in advance!
-Me
 
J

John Vinson

The 1st two windows should be kinda greyed out. Is it easily doable?

Very. Set their Enabled property to No in form design view.


John W. Vinson[MVP]
 
M

Mr B

For certain users you can use the following code to prevent them from being
able to add new records or edit existing records in a sub form:

Forms![YourFormName]![YourSubFrmName].Form.AllowAdditions = False
Forms![YourFormName]![YourSubFrmName].Form.AllowEdits = False
 
M

Me

Mr B,

I tired your suggestion, it works great. However, I was wondering if I could
make use of Roles that I have defined in Sql Server to make use of
additions/edit/delete?

'cause I have 2 groups of people, one group is admin, who should be able to
add/modify/delete records in the form.

The other users are departmentusers, who should be able to add records just
to the subform for which I will make use of the statements you suggested.

Something like -

If user = admin, then leave it alone. If user=departmentuser, then
allow additions to just one subform and turn additions/edits for other forms
to false.

Hope this makes sense.

Thank you very much for your suggestion!

-Me


Mr B said:
For certain users you can use the following code to prevent them from being
able to add new records or edit existing records in a sub form:

Forms![YourFormName]![YourSubFrmName].Form.AllowAdditions = False
Forms![YourFormName]![YourSubFrmName].Form.AllowEdits = False

--
HTH

Mr B


Me said:
I have an access form comprising of 3 subforms that in turn are linked to 3
different sql tables.

For some users, I would like them to insert records into just one subform
while the other two subforms are still available for viewing. I am able to do
this, wherein they will get error at the time of saving record. However, I
would like to restrict users from even data entry into the two forms in which
they shouldnt be entering any data. How can it be done without putting a
check for each and every entry on the form?

Imagine you have employee payroll, you can see the employee name, address,
ssn, etc. on top window.
2nd window shows dependents information.
the 3rd window is to enter some comments, users should be able to just add
comments into the 3rd window without making any changes to the 1st two
windows. The 1st two windows should be kinda greyed out. Is it easily doable?

Thanks for your help in advance!
-Me
 

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