Jumat, 01 Juni 2012

[MS_AccessPros] Re: Multi Level Login Form

 

I forgot to mention that I also check the user name at startup. If the name isn't in the User table I shut down the application. Permissions on the back end folder is also a good place to start with security. If they can't get to the folder they can't see any data.

Bill

--- In MS_Access_Professionals@yahoogroups.com, "Bill Mosca" <wrmosca@...> wrote:
>
> Alf
>
> I can't give you my code as it would be a security breach, but I can give you some help.
>
> Determine the user byl using an API call to get his Windows user name.
> Option Compare Database
> Option Explicit
> Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
> (ByVal lpBuffer As String, nSize As Long) As Long
>
> Public Function CurrentUserName() As String
> 'Purpose : Returns the network login name
> 'DateTime : 5/28/2002 09:54
> 'Author : Bill Mosca
> Dim lngLen As Long
> Dim X As Long
> Dim strUserName As String
>
> 'Create buffer
> strUserName = String(254, Chr$(0))
> lngLen = Len(strUserName)
> X = GetUserName(strUserName, lngLen)
>
> If (X > 0) Then
> 'Trucate remaining buffer space from end of string.
> CurrentUserName = Left$(strUserName, InStr(strUserName, Chr$(0)) - 1)
> Else
> CurrentUserName = vbNullString
> End If
>
> End Function
>
>
> Then keep 2 tables: one with UserID and UserGroup; the other with UserGroup and rank. By getting the rank you can show or hide controls on a form or menu.
>
> If you coded the way I do, it would be a simple matter of changing the User Level Security UserGroup for the one in the User table.
>
> Regards,
> Bill Mosca, Founder - MS_Access_Professionals
> http://www.thatlldoit.com
> Microsoft Office Access MVP
> https://mvp.support.microsoft.com/profile/Bill.Mosca
>
>
>
> --- In MS_Access_Professionals@yahoogroups.com, "Alf" <ohmaid@> wrote:
> >
> > Several years ago, I put together an application which allowed various level access, based on the user login. I now find myself having to replicate the process. Does anyone have any code or similar, which will allow me to bolt on to an existing DB, to save H O U R S of repeating myself.... Please.... Thanks...
> >
>

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar