Updated version of David Crake's "View users logged into database"

Status
Not open for further replies.

isladogs

MVP / VIP
Local time
Today, 03:34
Joined
Jan 14, 2017
Messages
18,548
Following requests from 2 forum members, I have updated & modified David Crake's utility to view users logged into a selected database.

See this closed thread: https://www.access-programmers.co.uk/forums/showpost.php?p=746480&postcount=1

The original only worked with MDB files and had a few issues

Changes made include:
1. It now works with ACCDB or MDB files.
2. Fixed issues monitoring databases on remote computers
3. List of users is updated automatically every 10 seconds
4. Improvements to the Lock Database feature

Info shown for each current user:
ComputerName - The computer name connected to the datafile
LoginName - (typically Admin) (aka: Access User Name)
Connected - Is the User Connected (Yes/No)
SuspectState - If Yes, the user has left the database in a "SuspectState" (possibly corrupted)

attachment.php


As in the original version, the utility allows you to lock external databases by creating a textfile 'Locked.txt' in the destination database folder
If this exists, a message is displayed stating that the database is unavailable due to system maintenance

For this to work successfully:
1. COPY the module modLockedOut to the selected database
2. ADD the line 'Call LockedOut' in the Form_Load event of the database startup form


EDIT 09/08/2017
The original code by David Crake required 3 non-standard VBA references
I have modified this removing the need for the Common Controls reference which wasn't installed with Windows 10 (and didn't work in 64-bit Access)
The updated reference list is:

attachment.php


NOTE:
When I'd almost completed this update, I discovered another similar utility by datAdrenaline also in the Sample Databases area:
https://access-programmers.co.uk/for...d.php?t=223434

Use whichever version you prefer ...
 

Attachments

  • Capture2.PNG
    Capture2.PNG
    33.1 KB · Views: 4,091
  • Capture5.PNG
    Capture5.PNG
    18.7 KB · Views: 4,050
  • CheckCurrentUsers_v2.zip
    CheckCurrentUsers_v2.zip
    61.3 KB · Views: 1,058
Last edited:
Brilliant - Works well. This raises some further questions.

I noticed the UI has a 'Disconnect User' feature - Which has not been developed, how this actually possible to do?

I also noticed that the computer name being picked up is actually the server name, making it difficult to identify who's actually connected. Is there an alternative way around this?
 
Hi
The two disabled buttons are features that David Crake said he was working on many years ago when he released his original version. I have to admit that I've not made any attempt to add these features and I believe you are the first person who has asked about them in all this time.
1. Its certainly possible to kick out all existing users. I do this in several apps using a table tblKickout with a Boolean field Kickout and one record. The value of that field is checked e.g. every 30 seconds. If set to true, a countdown procedure is initiated and after a set time e.g. 5 minutes, the app closes. I use this when an app needs to be closed for essential maintenance

However its not immediately obvious, at least to me, how to disconnect an individual user or why anyone would want to do so. I would welcome answers to both of those points.

2. The Send Message feature would be fairly simple to add. System tray alerts could be used when you want to message all users. Alternatively a simple messaging system (or email) could be used for individual users. Examples showing ways of alerting users can be found at https://www.access-programmers.co.uk/forums/showthread.php?t=295342 and http://www.utteraccess.com/forum/index.php?showtopic=1169381

I've not experienced any issues with the workstation listing as mentioned by you. What are the circumstances where this happens and which version/bitness of Access and Windows are you running?
 
Last edited:
just curious

The value of that field is checked e.g. every 30 seconds. If set to true, a countdown procedure is initiated and after a set time e.g. 5 minutes, the app closes.
does this work if the user machine is in sleep mode?
 
I believe so. All users were successfully disconnected after 6 minutes or so.
However it was normally used in conjunction with an idle disconnect feature whereby the app was closed if no user activity was detected within a specified time e.g. 20 minutes
 
Status
Not open for further replies.

Users who are viewing this thread

Back
Top Bottom