How to restrict field read/write authority for some users?

G

Guest

I have a module in my database that identifies the user (a function that
records their NT user ID when they log in). Is there a way I can restrict,
say, a text box or drop down menu from being selectable or editable
(essentially, read-only access) to some users while allowing others to have
full editing capability? Example:

Table: tblMainTable
Fieldname: txtRecord
Module value returned: NTUSER

Thanks in advance for any help~!
 
J

Jeff Boyce

If you are not up to the potentially strenuous exercise of implementing MS
Access security (make backups before you even start!), a simpler solution
would be to create a list of "authorized" logon IDs (this could be a
Constant you create in a module), then check to see if the logonID of the
current user is in the list.

As an example:

Me!cmdReports.Enabled = (InStr([YourList], GetUserName())>0)

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

Okay, I am liking this train of thought!

How about if I have an existing table with NTUSER as one of the fields and
their PERMISSIONLEVEL as another field (with values like "edit" and "read").
When people access the database, would it be possible to run a compare
between the value coming from my module's (modGETNTID) returned value
(NTUSER)? I don't mind having to use this code for each field in my form,
and in fact it would be desirable so I could still allow them to write in
fields that should be available to all?

Jeff Boyce said:
If you are not up to the potentially strenuous exercise of implementing MS
Access security (make backups before you even start!), a simpler solution
would be to create a list of "authorized" logon IDs (this could be a
Constant you create in a module), then check to see if the logonID of the
current user is in the list.

As an example:

Me!cmdReports.Enabled = (InStr([YourList], GetUserName())>0)

Regards

Jeff Boyce
Microsoft Office/Access MVP

J. Keggerlord said:
I have a module in my database that identifies the user (a function that
records their NT user ID when they log in). Is there a way I can
restrict,
say, a text box or drop down menu from being selectable or editable
(essentially, read-only access) to some users while allowing others to
have
full editing capability? Example:

Table: tblMainTable
Fieldname: txtRecord
Module value returned: NTUSER

Thanks in advance for any help~!
 
J

Jeff Boyce

The mechanism that works for you will be the one you work out. The concept
is to compare the logged on user's identity with a list. I provided one way
to do this.

Another might be to open a recordset containing all the rows of the table
you mention where NTUSER = your users logon. You could then iterate through
the records, setting control properties on the form.

Regards

Jeff Boyce
Microsoft Office/Access MVP

J. Keggerlord said:
Okay, I am liking this train of thought!

How about if I have an existing table with NTUSER as one of the fields and
their PERMISSIONLEVEL as another field (with values like "edit" and
"read").
When people access the database, would it be possible to run a compare
between the value coming from my module's (modGETNTID) returned value
(NTUSER)? I don't mind having to use this code for each field in my
form,
and in fact it would be desirable so I could still allow them to write in
fields that should be available to all?

Jeff Boyce said:
If you are not up to the potentially strenuous exercise of implementing
MS
Access security (make backups before you even start!), a simpler solution
would be to create a list of "authorized" logon IDs (this could be a
Constant you create in a module), then check to see if the logonID of the
current user is in the list.

As an example:

Me!cmdReports.Enabled = (InStr([YourList], GetUserName())>0)

Regards

Jeff Boyce
Microsoft Office/Access MVP

J. Keggerlord said:
I have a module in my database that identifies the user (a function that
records their NT user ID when they log in). Is there a way I can
restrict,
say, a text box or drop down menu from being selectable or editable
(essentially, read-only access) to some users while allowing others to
have
full editing capability? Example:

Table: tblMainTable
Fieldname: txtRecord
Module value returned: NTUSER

Thanks in advance for any help~!
 

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