473,378 Members | 1,375 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,378 software developers and data experts.

Who is logged on?

PhilOfWalton
1,430 Expert 1GB
In a multi-user environment with one BE database and several FE databases, is it possible without using additional tables to find out which other FE computers are linked to the BE.

I want to ensure exclusive use before compacting or copying the BE

Thanks

Phil
Aug 21 '16 #1
3 2202
NeoPa
32,556 Expert Mod 16PB
The info's in the ACCDB or LDB file Phil.

Full deconstruction of the file can be tricky, but it should have a specific size if you, and only you, have it open.
Aug 22 '16 #2
zmbd
5,501 Expert Mod 4TB
Go to the location of the backend file
the "backendname.laccdb" file may have this information...
In my WidowsOS configuration I can right-click the file
In the pop-up I have the {Send To} menu option and have Notepad as one of the options.
Google Search: Add Notepad to SendTo

Sending this file to notepad usually gives me at least a list of PC's connected to the database.

If there isn't a "backendname.laccdb" file then no-one has a lock on the file, that is to say, no one has a table, query, or form bound to a table open and active. This doesn't mean that a frontend isn't open, just that there are no current locks.

Personally, I use a combination of a hidden form and the tables to keep track of the current users, I find this to be much more reliable than just the laccdb file. The hidden form is on a timer event to check for a "maintenance request" record. On startup, this form also tries the connection and is error trapped to look for an exclusive (Access 2013, error 3045) and gracefully exits of true.

(opps, the 3 year old needed my attention and I thought I had posted this earlier... :( )
Aug 22 '16 #3
PhilOfWalton
1,430 Expert 1GB
Thanks guys, I had never investigated lAccDb files.

This is what I have come up with, the only hard coding is to use a known linked table ("TblMemberLog")

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Private Type UserRec
  5.    bMach(1 To 32) As Byte  ' 1st 32 bytes hold machine name
  6.    bUser(1 To 32) As Byte  ' 2nd 32 bytes hold user name
  7. End Type
  8.  
  9. '   Subject : WhosOn()
  10. '   Purpose : Will read *.LAccDb file and read who's currently
  11. '             logged on and their station name.
  12. '
  13. '             The LAccDb file has a 64 byte record.
  14. '
  15. '             The station name starts at byte 1 and is null
  16. '             terminated.
  17. '
  18. '             Log-in names start at the 33rd byte and are
  19. '             also null terminated.
  20. '
  21. '-------------------------------------------------------------------------------------
  22. Function WhosOn() As String
  23.  
  24.     On Error GoTo Err_WhosOn
  25.  
  26.     Dim IntlAccDeFile As Integer, IntStart As Integer
  27.     Dim IntLOF As Integer, i As Integer
  28.     Dim FileName As String
  29.     Dim sLogStr As String, sLogins As String
  30.     Dim ComputerName As String, UserName As String
  31.     Dim rUser As UserRec    ' Defined in General
  32.     Dim MyDb As Database
  33.     Dim DataPath As String
  34.  
  35.     ' Get the name of the Data Path
  36.     Set MyDb = CurrentDb
  37.  
  38.     DataPath = MyDb.TableDefs("TblMemberLog").Connect
  39.     If DataPath = "" Then                                   ' Local table
  40.         DataPath = MyDb.name
  41.     End If
  42.  
  43.     DataPath = Replace(DataPath, ";DATABASE=", "")          ' Get just the name
  44.  
  45.     i = InStrRev(DataPath, ".")
  46.     DataPath = Left(DataPath, i) & "l" & MID(DataPath, i + 1)
  47.     'Debug.Print DataPath
  48.  
  49.     ' Test for valid file, else Error
  50.     FileName = Nz(Dir(DataPath))
  51.     If FileName = "" Then
  52.         MsgBox "Couldn't find the file for the data" & vbCrLf & DataPath
  53.         Exit Function
  54.     End If
  55.  
  56.     IntStart = 1
  57.     IntlAccDeFile = FreeFile
  58.  
  59.     Open DataPath For Binary Access Read Shared As IntlAccDeFile
  60.     IntLOF = LOF(IntlAccDeFile)
  61.     Do While Not EOF(IntlAccDeFile)
  62.         Get IntlAccDeFile, , rUser
  63.         With rUser
  64.             i = 1
  65.             ComputerName = ""
  66.             While .bMach(i) <> 0
  67.                 ComputerName = ComputerName & Chr(.bMach(i))
  68.                 i = i + 1
  69.             Wend
  70.             i = 1
  71.             UserName = ""
  72.             While .bUser(i) <> 0
  73.                 UserName = UserName & Chr(.bUser(i))
  74.                 i = i + 1
  75.             Wend
  76.         End With
  77.         sLogStr = ComputerName & " -- " & UserName
  78.         If InStr(sLogins, sLogStr) = 0 Then
  79.             sLogins = sLogins & sLogStr & "~"          ' Separate the computers & Usrs with a tilde
  80.         End If
  81.         IntStart = IntStart + 64                          'increment to next record offset
  82.     Loop
  83.     Close IntlAccDeFile
  84.     WhosOn = sLogins
  85.  
  86. Exit_WhosOn:
  87.     Exit Function
  88.  
  89. Err_WhosOn:
  90.     If Err = 68 Then
  91.         MsgBox "Couldn't populate the list", 48, "No LDB File"
  92.     Else
  93.         MsgBox "Error: " & Err.Number & vbCrLf & Err.Description
  94.         Close IntlAccDeFile
  95.     End If
  96.     Resume Exit_WhosOn
  97.  
  98. End Function
  99.  
Phil
Aug 22 '16 #4

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

Similar topics

9
by: mallyonline | last post by:
I last posted to this group about 6 months ago and was very pleased by the excellent response I got and the great help offered to me. I am back this time with another request for your expert help...
7
by: Tim.D | last post by:
Folks, I did run into a small problem afterall. Running my first SP I am seeing a number of errors in the windows 2k server event viewer. Following is a paste: -- 2004-03-03-15.06.49.967001 ...
8
by: Mike Thomas | last post by:
I have two clients now who want to have an Access 2000 & 2002 application running on NT Server 2000 do some file updating at night when nobody is in the office. I have used Windows scheduler to...
8
by: Vince Varallo | last post by:
Hello All, I would like to display all logged on users on a web page. I store each user's name in a session varible, but I don't seem to be able to loop through a sessions collection to view...
6
by: John Dalberg | last post by:
I want to automate the process of logging into an intranet. I want to pull out the username of the Windows user logged into the machine running the browser and use the username in my app. How can I...
11
by: Alan Silver | last post by:
Hello, I am just planning a new ASP.NET site, and wondered about the best way to handle the following common scenario... The site has the option that registered users can log in and will have...
40
by: Jeff | last post by:
I have a system on a network and want to determine if anyone is currently connected to the back-end files. An interesting twist is that I have noticed that some users can be connected (have the...
4
by: Jarod_24 | last post by:
How do a windows-service detect whether a user is logged or not on a computer? So far i've found nothing in the windows api or any code examples that will allow me to figure this out. The...
5
by: jefftyzzer | last post by:
Friends, Three questions for you: 1. Are CREATE INDEX statements against DGTTs logged? 2. While running the SP recently, it died with a "transaction log filled" (SQL0964C) message while it...
2
by: Keith G Hicks | last post by:
asp.net 2.0 I have set my web.config as follows: <forms timeout="30"/(I know that's the default but I may chang it so the line's in there) I also have a few cookies I'm setting on my login...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.