Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding Current User 3

Status
Not open for further replies.

1starr

Programmer
Feb 19, 2002
34
US
I was wondering if there is a way to find out who is logged into the database. I have a problem with identifying the person or persons who are logged into the database when I need to make changes, because they are accessing the database on the network. Any help with this problem is greatly appreciated.
 
If you have a split database, and each user has a separate front end, you can search the folders where the front-ends are located, and look for .ldb files. This will tell you who has their front end open.

Otherwise, the only way is to see who has the msaccess.exe process running.

 
If I rememeber right (and I can't chek it right now), viewing the .ldb file with a text editor such as notepad will give you the computer name and access level of the user at that computer.....

This will at least give you the PC name and from there you may be able to figure out who has it open.

BTW, if you search around here, there are ways to "kick' people out of the database for such instances. Maybe not the most graceful method...but it can be done. Please remember to give helpful posts the stars they deserve!
This makes the post more visible to others in need! [thumbsup2]

Robert L. Johnson III, A+, Network+, MCP
Access Developer/Programmer
robert.l.johnson.iii@citigroup.com
 
I've just looked at an .ldb file using notepad, and it is not in plain text, so I'm afraid it appears that Robert's suggestion won't help. There might be a MS utility whichh allows this type of file to be read, though. I'll let you know if I find one.

Howard

 
There is a utility called ldbview.exe that will show you who is logged on to the mdb. Search on Google for it.
 
Check out this thread Thread705-388289. It will let you know who is logged on to a given database. You can simply copy and paste the code.
 
The ldbview.exe is available to be downloaded from the Microsoft site in a download file called Jetutils.exe
 
I have a question regarding this thread, I have about 100 users so this tool would be useful, but the code works, when I click enter to return users...only my information is displayed. I know other users are in the Access database besides me, it seems like its only reading my computer not the Access Database as whole....any suggestions on how to accomplish that?

Thanks for all the info,
Clark
Honda of America Manufact.,
 
Not sure which post you are referring to. If you are referring to my last post, then you need to reference a file that all user may be accessing. In the example I gave in the thread Thread705-388289, the ShowUsers function passed the name of the file as path\system.mdw (this was just an example). If you passed system.mdw, you are the only one that is using that file.

To make it work correctly, you need to pass the name of a workgroup file that your users are attached to or pass the name of the back-end database.

For example,

Call WhosLoggedOn("\\path\YourWorkgroup.mdw", rst)

or

Call WhosLoggedOn("\\path\YourBackEndDatabase.mdb", rst)
 
Guys,
.ldb file viewed with the Notepad gave me

PA1767-11524x Admin

So it IS in plain text

TIA
 
This works good to read the users network userid:

Option Compare Database

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

Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If lngX <> 0 Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = &quot;&quot;
End If
End Function

This gets userid and computer name also:
Option Compare Database

Private Declare Function api_GetUserName Lib &quot;advapi32.dll&quot; Alias _
&quot;GetUserNameA&quot; (ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function api_GetComputerName Lib &quot;Kernel32&quot; Alias _
&quot;GetComputerNameA&quot; (ByVal lpBuffer As String, nSize As Long) As Long

Public Function CNames(UserOrComputer As Byte) As String
'UserorComputer; 1=User, anything else = computer
Dim NBuffer As String
Dim Buffsize As Long
Dim wOK As Long

Buffsize = 256
NBuffer = Space$(Buffsize)

If UserOrComputer = 1 Then
wOK = api_GetUserName(NBuffer, Buffsize)
CNames = Trim$(NBuffer)
Else
wOK = api_GetComputerName(NBuffer, Buffsize)
CNames = Trim$(NBuffer)
End If
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top