Identifying Users on Multiuser Environment

  • Thread starter Thread starter gregmiami
  • Start date Start date
G

gregmiami

Guest
Hello, Just wanted to know if it was possible to do a script or run a command on VBA to identify which users are logged into the database at a specific moment in time.
 
Hi gregmiami,

you can probably change the below to get out some of what you want. you can read the .ldb directly as a text file ( just send it to notepad ) and see what it contains. Our PC names here are 10 chars long, if yours are a different length then just change the 12 below to a relevant number.
The below code sends a message ( txtMessage ) to every user currently logged in.
I guess that if you have a copy of 'who has' or somethin similar you could then look up who is logged onto the PC id's returned.

Function SendShutDown(ZFileName As String, txtMessage As String) As String

Dim AFile As Integer
Dim strCommandLine As String

Dim strComputerName As String

AFile = FreeFile
Open ZFileName For Input Shared As #AFile ' Create filename.
SendShutDown = "Message sent to: "
Do While Not EOF(AFile)
strComputerName = Input(36, #AFile) ' Get one user
strCommandLine = "NET SEND " & Left(strComputerName, 12) & " " & txtMessage
Shell (strCommandLine)
SendShutDown = SendShutDown & Left(strComputerName, 12) & "; "
Loop
Close #AFile ' Close file.

End Function

Chances are that if you have inbuilt access security set up there's a far easier way of doing this. Also I have no idea if this works for 2k or not - I only have '97

HTH

Drew
 
Alternatively you could use the Ldb viewer software free from microsofts home site - email me and I'll send you a copy if you can't find it
 
A third option is that I force an opening "splash" screen to be opened when the database is opened. (The Northwind example shows you how to do this.) But instead of letting the splash screen exit, I minimize it, hide it, and make an entry in my database's audit table. When they try to exit from Access, the hidden/minimized splash form's Form_Close routine makes another entry that is different. When I want to see who is in the database, I look for "Opens" with no subsequent "Closes" - this works pretty well most of the time.
 
Thank you all for your replies:

Could u email me that software to view the ldb file. What Im trying to do:

Users must perform an import process that involves all users to be logged off.

What im trying to do is to write a script that could pop up to the user so that the user could see if all users are off the system.

I appreciate ur help

thanks

greg
 

Users who are viewing this thread

Back
Top Bottom