View Full Version : Solved: Identify logged-in users & message them
Duncs
02-11-2010, 02:25 AM
I have an Access db, FE/BE, and I sometime need to update the BE data, or get them to use the latest version of the FE. What I need is a way to idntify all users of the DB, and then either display a message that ask them to log out, or frmo their logged in ID, I can e-Mail them.
Can anyone help?
TIA
Duncs
The file that is created when Access opens a DB is the .ldb file, that contains the names of the users in the database and can be opened by Access or Word.
Duncs
02-11-2010, 04:08 AM
The DB I'm looking at implementing it in, shows no names in it...not even mine when I open the file. I can't delete the file either, in a hope to throw the user out straight away.
What I'd like to do, is somehow show the users ID / PC ID, and then somehow send a message to them / display a message box, asking them to log-out. It would also be nice if I could somehow "kick them out" o teh database, as users have been known to leave the PC swithed on and go home, with the application still loaded, or just switch off the PC without logging out.
Possible?
Duncs, I was going to write exactly what you have written about Users leaving the database open, but I thought it might just be my experience.
I create a Table to hold those that are logged in (and out) so that I can see who does what (including adding/changing data).
You can do exactly what you want, providing that the database is secured.
geekgirlau
02-14-2010, 08:46 PM
This idea has 2 parts. It assumes that you have a text file, where you type the word "lock" if you want to force users out of the database.
Function to read a text file to see whether to close the database (returns True if we need to close):
Function fGetOut() As Boolean
Dim strValue As String
Const cstrLockout As String = "C:\DB_Path\Lockout.txt"
On Error GoTo ErrHandler
fGetOut = False
If Dir(cstrLockout, vbNormal) <> "" Then
Open cstrLockout For Input As #1
Do While Not EOF(1)
Input #1, strValue
If UCase(strValue) = "LOCK" Then
fGetOut = True
End If
Loop
End If
ExitHere:
On Error Resume Next
Close #1
Exit Function
ErrHandler:
' no message box on error
Resume Next
End Function
Part 2: A form that is open at all times, with a timer event. This can either be a switchboard-type form, or perhaps a hidden form that is opened on database launch without the user seeing it. The form's timer interval is set to check the function every few minutes.
Private Sub Form_Timer()
If fGetOut() = True Then
Application.Quit
End If
End Sub
Duncs
02-15-2010, 05:07 AM
Many thanks for this. It's such a simple idea, and gives me something to work on.
Cheers
Duncs
geekgirlau, I am sure that you have posted that before, but I searched the forum and KB and couldn't find it. Can you remember where you posted it originally?
geekgirlau
02-21-2010, 04:34 PM
Absolutely no idea! :confused3
I've used variations of this for many years, and the method used has morphed over time.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.