Code for database user access

T

Tammy S.

I have a database with a field I want to restrict access to. Each user has a
user ID that they use to log into the network. That ID was used for the
Security Wizard. Some of the users are permitted to see SSNs and others are
not. The old version of the databse has code that uses the network ID to
determine if the user can see this info after clicking on the "Show SSN"
button. I am unable to replicate this code.

Also, I'd like to have the user's ID automiaticall populate the "Entered By"
field whenever they enter a new record.

I have a table for all database users listing their name and user ID. They
all have permissions to use forms only with one granted admin rights as a
back-up for me.
 
S

Salad

Tammy said:
I have a database with a field I want to restrict access to. Each user has a
user ID that they use to log into the network. That ID was used for the
Security Wizard. Some of the users are permitted to see SSNs and others are
not. The old version of the databse has code that uses the network ID to
determine if the user can see this info after clicking on the "Show SSN"
button. I am unable to replicate this code.

There's code in the SeqFaq document (you can google for it) that shows
you how to find out if a person is a member of the group. With the
function, let's say only a member of group "HR" can see the SSN, then
you could have somethink like
Me.SSN.Visible = (faq_IsUserInGroup("HR", CurrentUser))
Also, I'd like to have the user's ID automiaticall populate the "Entered By"
field whenever they enter a new record.

In your BeforeUpdate, perhaps AfterInsert event you could, if the field
were called CreatedBy, enter
Me.CreatedBy = CurrentUser

BTW, currentuser is the name supplied when logging in. If you aren't
prompted for a username/password, CurrentUser is "Admin". You can get
the name of the person logged into the computer (not Access name) at
http://www.mvps.org/access/api/api0008.htm.
 

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