Kill connection on MS Access database

Posted on 2003-03-29
Medium Priority
Last Modified: 2012-06-27
Does anyone known if there is a utility or simmilar to kill a user connection to a MS Access 2000 database?

I have a database in a network and many users who only have read access.

If, for any reason, I need to make a little change in a Form or to repair and compress, etc., etc I have to ask everbody who is connected to get out and when all of them are out I can take the control.

And if someone is not in their desk I can´t close the application until he comeback.

Thank you
Question by:dspeier
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
LVL 28

Expert Comment

ID: 8230995
Firstly, I would not let the users share your FrontEnd App. Personally I would copy the front end to the local PC rather then get then run the front end across the network. When you have done your development changes then release a new version to them when you are ready.

With regards to your actual problem, Windows NT (and I assume Novell does also) has the facility to check who is locking the file and you can then force them off.

Cheers, Andrew

Expert Comment

ID: 8231111
I agree with TexReport. Leave the users alone. Do your changes on another database and release it at night. Same for the compacting.

You can use Control Panel/Computer Management/Shared Folders/Sessions to see who is connected and kick them out, but I would not recommend doing so: This is rude.

Author Comment

ID: 8231382
The problem is that I don´t have Administration rigths on the NT server where is the database running.

Don´t you know any utility to do so? or to send a messagge to the user thru the access?
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.


Expert Comment

ID: 8231454
You can use the NET SEND command, something like:

net send <username> "Please close your database, I need to do some maintenance. Thanks"

You could also develop something more sophisicated: A hidden form with its Timer Event reading a table. When the value of this table is changed, make the form visible, wait for a few minutes and close the application.
LVL 28

Expert Comment

ID: 8231490
Although the LDB file will indicate which PC is locking the file it will not indicate the username, you need to pass it on to your network administrater to "kick them out".

Other options to think about are:-

1. An AutoClose procedure if the user hasn't done something for a specified amount of time.
2. A messaging routine to all current users logged in.

Both of these can be achieved using the OnTimer event of your main form.

Cheers, Andrew

Accepted Solution

Volibrawl earned 140 total points
ID: 8231942
I agree totally with the others.  Your application should be split into a backend and several frontends.  The following technique will work either way, however.  The form with the timer event needs to be running on the user's machine (either through the shared application or their own frontend).

Here is some code I use in one application.
It requires:
One table, a timer form and a message form, a snippet of code.

1. Create a new (timer) form, set it to open and hide on startup of the application.  Leave it open always.  Attach the code to the form's Timer Event and set it to "look" every couple of minutes. My timer is set to 3 minutes, but yours could be anything.

2.Create a simple form (for the message) that has a label with a message in it tht the sytem will be shut down.

3.Create a table (U BUMP).  It only needs 2 fields (BUMPLVL and BUMP). Bumplvl is only used to "help" the dlookup, put a 1 in it.  The table should be a linked table which the administrator has access to OR if the application is a single shared app, it needs to be in the database that all the users are using.

USAGE/LOGIC: When desired, the administrator opens the table (u Bump)and changes the value of the field "Bump" to WARN.  When the code runs, it sees that value and causes a message form to open (the form basically says get out 'cuz the application will be shut down in 5 minutes.)
Five minutes later, the Administrator then sets the value of "Bump" to NOW.  When the form's timer sees that the value is NOW, it runs the quit command closing the DB.

Private Sub Form_Timer()
   Dim bumpout As String
   bumpout = DLookup("bump", "u bump", "bumplvl=1")
   If bumpout = "Warn" Then
   DoCmd.OpenForm "bump message"
   ElseIf bumpout = "Now" Then
End If


Author Comment

ID: 8232088
Thank you very much to all of you. I will use your advices and will try to do what Volibrawl said.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question