Senin, 11 Februari 2013

[MS_AccessPros] Re: Seeing users that have a database open

 

Kickerpark8 (Your name?)

The locking file for 2007-2010 file format has the extension .LACCDB. But that won't bve of much use since the User Level Security is not supported with the new accdb files. There are a couple of common ways to get the windows user name.

Public Enum ObjectProp
USER_NAME
PC_NAME
DOMAIN_NAME
End Enum

Public Function GetUserInfo_Script(lngProperty) As String
'Purpose : Get User and computer info using Scripting DLL.
'DateTime : 10/25/2004 06:56
'Author : Bill Mosca
Dim objNet As Object

Set objNet = CreateObject("wscript.network")

Select Case lngProperty
Case ObjectProp.USER_NAME
GetUserInfo_Script = objNet.UserName
Case ObjectProp.DOMAIN_NAME
GetUserInfo_Script = objNet.UserDomain
Case ObjectProp.PC_NAME
GetUserInfo_Script = objNet.ComputerName
End Select

Set objNet = Nothing

End Function

- or -

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

Regards,
Bill Mosca, Founder - MS_Access_Professionals
http://www.thatlldoit.com
Microsoft Office Access MVP
https://mvp.support.microsoft.com/profile=C4D9F5E7-BB03-4291-B816-64270730881E
My nothing-to-do-with-Access blog
http://wrmosca.wordpress.com

--- In MS_Access_Professionals@yahoogroups.com, "kickerparks8" wrote:
>
> I have a database that has a range of management users that can log in and run reports or update information, but I need something to see which users are in the database, in older versions there was a .ldb viewer that would show me user names but it doesn't work on 2007 since the file extensions have changed to .accdb
>
> Any help would be great. thanks
>

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar