473,404 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

How can I tell if more than one person has a .mdb file open concurrently?

How in code can I determine if the current front end .mdb file is being used by more than one person?

Can I determine how many people?

Can I determine who?

Can I determine who and how many are using a back end .mdb file?

Thanks in advance for sharing your experience.
Oct 5 '09 #1

✓ answered by ADezii

The following code will generate a Listing (Debug Window) of currently Logged-On Users along with their Computer Names by using the OpenSchema() Method of the ADO Connection Object. You may also wish to view the supplied Link which contains similar code:
Expand|Select|Wrap|Line Numbers
  1. Const conUsers = "{947bb102-5d43-11d1-bdbf-00c04fb92675}"
  2.  
  3. Dim cnn As ADODB.Connection
  4. Dim fld As ADODB.Field
  5. Dim strUser As String
  6. Dim rst As ADODB.Recordset
  7. Dim varValue As Variant
  8.  
  9. Set cnn = CurrentProject.Connection
  10. Set rst = cnn.OpenSchema(Schema:=adSchemaProviderSpecific, SchemaID:=conUsers)
  11.  
  12. 'Set  Heading
  13. Debug.Print "Computer,UserName"
  14.  
  15. With rst    'fills Recordset (rst) with User List data
  16.   Do Until .EOF
  17.     intUser = intUser + 1
  18.       For Each fld In .Fields
  19.         If fld.Name = "COMPUTER_NAME" Or fld.Name = "LOGIN_NAME" Then
  20.         varValue = fld.Value
  21.           'Some of the return values are Null-Terminated Strings, if
  22.           'so strip them off
  23.           If InStr(varValue, vbNullChar) > 0 Then
  24.             varValue = Left(varValue, InStr(varValue, vbNullChar) - 1)
  25.           End If
  26.           strUser = strUser & varValue & ","
  27.         End If
  28.       Next
  29.         Debug.Print Left$(strUser, Len(strUser) - 1)
  30.         strUser = ""        'Reset
  31.         .MoveNext
  32.   Loop
  33. End With
  34.  
  35. 'Routine cleanup chores
  36. Set fld = Nothing
  37. Set rst = Nothing
  38. Set cnn = Nothing
OUTPUT (Single User):
Expand|Select|Wrap|Line Numbers
  1. Computer,UserName
  2. DEZII,Admin
http://bytes.com/topic/access/insigh...rate-user-list

2 2046
ADezii
8,834 Expert 8TB
The following code will generate a Listing (Debug Window) of currently Logged-On Users along with their Computer Names by using the OpenSchema() Method of the ADO Connection Object. You may also wish to view the supplied Link which contains similar code:
Expand|Select|Wrap|Line Numbers
  1. Const conUsers = "{947bb102-5d43-11d1-bdbf-00c04fb92675}"
  2.  
  3. Dim cnn As ADODB.Connection
  4. Dim fld As ADODB.Field
  5. Dim strUser As String
  6. Dim rst As ADODB.Recordset
  7. Dim varValue As Variant
  8.  
  9. Set cnn = CurrentProject.Connection
  10. Set rst = cnn.OpenSchema(Schema:=adSchemaProviderSpecific, SchemaID:=conUsers)
  11.  
  12. 'Set  Heading
  13. Debug.Print "Computer,UserName"
  14.  
  15. With rst    'fills Recordset (rst) with User List data
  16.   Do Until .EOF
  17.     intUser = intUser + 1
  18.       For Each fld In .Fields
  19.         If fld.Name = "COMPUTER_NAME" Or fld.Name = "LOGIN_NAME" Then
  20.         varValue = fld.Value
  21.           'Some of the return values are Null-Terminated Strings, if
  22.           'so strip them off
  23.           If InStr(varValue, vbNullChar) > 0 Then
  24.             varValue = Left(varValue, InStr(varValue, vbNullChar) - 1)
  25.           End If
  26.           strUser = strUser & varValue & ","
  27.         End If
  28.       Next
  29.         Debug.Print Left$(strUser, Len(strUser) - 1)
  30.         strUser = ""        'Reset
  31.         .MoveNext
  32.   Loop
  33. End With
  34.  
  35. 'Routine cleanup chores
  36. Set fld = Nothing
  37. Set rst = Nothing
  38. Set cnn = Nothing
OUTPUT (Single User):
Expand|Select|Wrap|Line Numbers
  1. Computer,UserName
  2. DEZII,Admin
http://bytes.com/topic/access/insigh...rate-user-list
Oct 6 '09 #2
Perfect! Thanks!!!
Oct 6 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
116
by: Mike MacSween | last post by:
S**t for brains strikes again! Why did I do that? When I met the clients and at some point they vaguely asked whether eventually would it be possible to have some people who could read the data...
2
by: Corne' Cornelius | last post by:
Hi, When you open a file for writing/appending with open() or fopen(), and you have multiple applications that might want to write to the same file at the same time, could that cause weirdness...
0
by: Arjen | last post by:
Hello, I have made a little test application and needs some help. I have two classes with hash tables which I want to serialize inside one xml file. My question is if someone can make the...
0
by: Arjen | last post by:
Hello, I have made a little test application and needs some help. I have two classes with hash tables which I want to serialize inside one xml file. My question is if someone can make the...
13
by: Jiho Han | last post by:
Here's the issue. You have a class, Class Person { public int id; public string firstname; public string lastname; }
18
by: shilpa.saraogi | last post by:
Heya all, How do I tell, prgrammatically, if a file is opened for read/write by some other process? In unix .. of course. My program needs to open files and work on it, and I want it to make...
14
by: salad | last post by:
XML seems to be a hot technology buzzword. And it appears XML is supported in A2003. I am wondering if it could be used in the following scenario. I create an order record for the customer. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.