Varying security levels thru NT login

IanH

Registered User.
Local time
Today, 20:16
Joined
Feb 19, 2001
Messages
34
Hi guys,

(Using NT and Access 2000)

I have a colleague wishing to set security for a database (and specifically making all objects read only), without requiring users to enter a password.

I was thinking there may be a way to check the NT login and if it matches against a small subset of users, then the security access level is set to that of an administrator, otherwise they are only allowed limited access.

We do not have the user/group security set up (and do not wish to do so for this one database), and my colleague does not want them to have to enter passwords to login or for the database. They are less concerned about the users being able to see the module as they are not likely to amend any of the code.

Can this be done and how would it be coded?

Thanks in advance for any solutions.

Ian


[This message has been edited by IanH (edited 02-08-2002).]
 
Hi Ian. To check the NT user name use the following code.

Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long


Public Function GetNTUser() As String
Dim strUserName As String
'Create a buffer
strUserName = String(100, Chr$(0))
'Get user name
GetUserName strUserName, 100
'Strip the rest of the buffer
strUserName = Left$(strUserName, InStr(strUserName, Chr$(0)) - 1)
GetNTUser = strUserName
End Function

Once you have captured the login name you can then check this against a list of users held in a table and take the appropriate action.

David
 
Thanks for the help. This works fine for getting the NT login. Now I've just got to read the helpfiles to see how to vary the security settings based.

Ian
 

Users who are viewing this thread

Back
Top Bottom