How to see people who are logged in

RompStar

Well-known Member
Joined
Mar 25, 2005
Messages
1,200
Ok, we build this database in Access. We drop the access file on our shared network \\network\\bla\\bla

Then shortcuts are created to that network point, and each users computer has Access installed. User double-clicks on the shortcut and starts up Access locally, reading the file remotely.

So as you can imagine, a lot of people log in to use this, sometimes I have to do updates and I need to have everyone log out and I need to know the people that are STILL logged in.

How do I do this, to figure out who is still logged in.

Has anyone written a VBA script to do this yet ? :unsure:

I am somewhat learning Access still, so I am not sure, please help!!!!

Thank you.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Here is one idea for you to consider...

Open a hidden form when your database starts. Use the OnTimer event of this hidden form to check for the existence of a text file named DatabaseOn.txt If the file exists, then let the database continue. If the file does not exist, then use code to exit the database. When you need to shut the database down for maintenance, just rename the text file from DatabaseOn.txt to DatabaseOff.txt and when the OnTimer code runs, it will not be able to find your DatabaseOn.txt file and shut down the database. This is a method that I use and it works quite well.


As for knowing who is logged into the database, I also use a text file to hold the logonId of the user who has logged in. When this hidden form opens, some code gets the logonid of the user and writes it to a text file. When this hidden form closes, it erases the logonid from the text file. I know at all times who is in the database by checking this text file.

Good Luck.

David
 
Upvote 0
So I started the database locally on my desktop and it created a *.ldb file, which always happens, then I tried Searching the entire path of my hard drive c:\ for the DatabaseOn.txt and it didn't find it, I included in the search path all hidden files and directories.

I Use Access 2003, what you use ?
 
Upvote 0
RompStar,

Sorry in taking so long to answer your question. I have been on vacation on the beach at Ocean City, Maryland. I think you have misunderstood my suggestion. You need a to add this code to a startup form's On Timer event and set the Timer Interval to 300000 so that this code will run every 5 minutes.


Code:
MyPath$ = "S:\MyDatabaseFolder\"  'Replace this with the path to your database folder

If Len(Dir$(MyPath$ & "DatabaseOn.txt")) > 0 then
     'Continue
     'DoCmd.OpenForm "frmMainDatabaseForm" 'Replace this with your Main Form Name
Else
     Msgbox "The database is currently down for maintenance.  Please try again in 15 minutes"
     Application.Quit acQuitSaveNone
End If

The startup form can be a blank form that starts up automatically when the database starts.  Just put the above code in the On Timer event of that start up form and test it out.

Thanks,

David
 
Upvote 0
I like this piece of code.. but I have one question/comment. The users database won't actually close until they click on the dialogue box saying the database is down for 15 minutes. At least that's what it looks like to me. So if the user is away from their desk for an extended period of time this won't really work, right?
 
Upvote 0
cordevil95,

You are correct. This example code that I have posted will not close until the user presses OK on the message box. In reality, the way that I use this code is to display a "shutdown" form that has the message stating that the database is about to close. The shutdown form has a timer that will shut the database down after 30 seconds of the shutdown form being displayed.

I hope that this helps.

Thanks,

David
 
Upvote 0

Forum statistics

Threads
1,215,945
Messages
6,127,851
Members
449,411
Latest member
adunn_23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top