Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > Forums > Developers
Back to Access Developer Forum    Comments List
Upload Images   Link   Email  
Detect multiple users
Brian Crawford 
    
8 months 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 
             
8 months ago
follow
Adam Schwanz 
            
8 months 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 
            
8 months ago
Manually
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 
            
8 months ago
Untested and unsure it'll work on .accdb.
LDB Viewer Form from Access MVPS Org
Alex Hedley 
            
8 months ago
Logged In Users from isladogs

(View users logged into database from David Crake)
Thomas Gonder 
       
8 months 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 
       
8 months ago

Brian Crawford OP 
    
8 months 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 
       
8 months 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 
       
8 months ago

Thomas Gonder 
       
8 months 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 
  
8 months 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 
            
8 months ago
As an aside if you want to do the same in MS SQL SERVER you can run the sp_who command.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer Forum.
 

 
 
 

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

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

LinkedIn
Copyright 2025 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 2/15/2025 2:03:33 AM. PLT: 1s