Free Lessons
Fast Tips
Topic Index
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
Home > Forums > Developers
Back to Access Developer Forum    Comments List
Detect multiple users Upload Images   Link   Email  
Brian Crawford      
33 days ago
Is there a way in VBA to detect how many users have an access DB open at the moment?  I am also interested in a way to be able to list the current users that have the DB open.
Sami Shamma              
33 days ago
Adam Schwanz             
33 days ago
I'm not sure if there's specific code to see for instance how many connections are going to the backend at a given time, but you could track it easily enough. Just make a table and during login or load, enter the name into the table. When closing remove the name from the table.
Alex Hedley             
33 days ago
You could check in Task Manager
Or use SysInternals
- Process Explorer (v17.06)
- PsLoggedOn (v1.35)

Via command
ps -ef | grep "KEYWORD"

Need to find out which id is the user ($2 is PID)
ps -ef | grep "KEYWORD" | awk '{print $2}'

Another option is via WMI Tasks: Processes

Try a few different ways, then convert it to VBA.
Alex Hedley             
33 days ago
Untested and unsure it'll work on .accdb.
LDB Viewer Form from Access MVPS Org
Alex Hedley             
33 days ago
Logged In Users from isladogs

(View users logged into database from David Crake)
Thomas Gonder       
32 days ago
How about knowing who the users are and what they're doing? Sorry, I only have my single user open at the moment, but you get the idea. Those with a processing status (Ps) other than 0 are currently active.
Thomas Gonder       
32 days ago

Brian Crawford      
31 days ago
Interesting approaches.  My primary interest is in creating a capability to let one user know who might lock or collide with their session.  If I can show them the username, they can know who to coordinate with.  I have a front end and backend, and sometimes have issues of two users using the same front end, which creates problems because each user's path to the backend is different (sometimes more than just the user profile prefix).  I try to tell them to download their own cop of the front end, but people often don't do that.  I would like to compare the current user with the list of active users so that I can warn them.
Thomas Gonder       
31 days ago
@ Brian. First, if I understand correctly, you have two different users, on different workstations, using the same .accdx file (not a copy) to get to the backend (I'm confused how they get to different backends unless you've set up a way to choose which "client's data" they are accessing). That's a big no-no from what I've read, some claiming it will cause serious data corruption. I can confirm it will cause the front-end applications (forms and updates) to do weird stuff, if not give a bunch or warning/error messages when running. If they are using the same file from a networked computer, you may want to fix that immediately by limiting access/permissions to that file. They should be running a .accdx file that sits on their workstation. Also, if more than one Windows user can share the workstation and have an active session, you'll want to make sure they too can't have the same file open at the same time.

Second, My personal perspective is to never warn a user that they're about to do something they shouldn't, for whatever reason. The whole idea of optimistic record locking, for example, is ludicrous. Use some kind of lock table to prevent (and you can explain in a message) why they can't do something at the moment. I'll give an example below.
Thomas Gonder       
31 days ago

Thomas Gonder       
31 days ago
In the above image, an update query is running on the Entity Table (for information on organizations and people). When a user tries to Edit my test record Zelma, the background of the form turns red and a message is shown on the top line of the yellow Status box that a lock is set. I try to be fairly complete with the message, as I don't want an administrator calling me up and asking, "So, where was this lock set?"

Please excuse some slight errors in the previous message, the eyes are getting a bit blurry at this hour.
Christopher Hankwembo    
30 days ago
I'm not sure if there's specific code to see for instance how many connections are going to the backend at a given time, but you could track it easily enough. Just make a table and during login or load, enter the name into the table. When closing remove the name from the table.

Just get this book from Amazon it will do what you want code are there but we cannot share because of copyright issues

Real World Microsoft Access Database Protection and Security
Alex Hedley             
27 days ago
As an aside if you want to do the same in MS SQL SERVER you can run the sp_who command.
Add a Reply Upload an Image


The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.

Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
My Account
My Courses
Lost Password
Student Databases
Change Email
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Customer Support
Web Site Tour
Consulting Services
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 7/15/2024 4:59:36 AM. PLT: 1s