473,750 Members | 2,308 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do you knock out users or Disconnect users from a database remotely?

anoble1
245 New Member
I have multiple Access 2003 databases. I do most of the editing in them all the time. I am having a problem of users all over the state being in the database, and won't get off of it. I currently use LDB Viewer. (Which just tells me the computer name that's currently connected). But, is there a way I can write something that will knock everyone out, of whomever I choose, so I can edit the database?

Thanks
Jan 6 '10
14 37633
Megalog
378 Recognized Expert Contributor
Twinny,
Sadly, I dont have an easy copy/paste code solution to provide for this. I posted my basic approach at the beginning of this thread, and you should use this as a roadmap to your custom approach. It will involve the use of a hidden form with a timer, a small table to store the login/logout information, and basic code to save & close access.
If you get stuck on any specific steps, leave a detailed post and I'll try to provide an answer.
Jan 30 '12 #11
GrnMtn7
1 New Member
@anoble1
I found a simple solution a year back or so that involves opening a form Let's call it zzMXLOCK with the autoexec macro. It opens hidden and the OnLoad Event looks like this:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. Dim strFileName As String
  3. strFileName = Dir("X:\NetworkFolder\Subfolder\LOCK.ozx")
  4.         If strFileName <> "LOCK.ozx" Then
  5.         Application.Quit acQuitSaveAll
  6.         Else: DoCmd.OpenForm "zzMxShutdown", acNormal, "", "", acFormReadOnly, acHidden
  7.         DoCmd.CLOSE acForm, "zzMxLock"
  8.         DoCmd.OpenForm "MAINNAVIGATION PAGE”
  9.  
This will only work for a split database where you can have the form “look” for a specific file
By renaming the file when the database goes to load and the macros are enabled (use .accde Or .mde)
The one form loads sees the file doesn’t exist and keeps the user from entering the DB. This locks the database, now the form “zzMXShutdown”m entioned above does that same thing but on Open and On Timer. To be nice I add a form called “zzAppShutdownW arn” that lets the user know they are about to be booted. The nice thing about calling a form and not a message box is you can more easily tailor the message later.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2.     ' Set Count Down variable to false
  3.     ' on the initial opening of the form.
  4.     boolCountDown = False
  5. End Sub
  6.  
  7. Private Sub Form_Timer()
  8. On Error GoTo Err_Form_Timer
  9.     Dim strFileName As String
  10.     strFileName = Dir("X:\Networkfolder\Subfolder\LOCK.ozx")
  11.     If boolCountDown = False Then
  12.         ' Do nothing unless the check file is missing.
  13.         If strFileName <> "LOCK.ozx" Then
  14.             ' The check file is not found so
  15.             ' set the count down variable to true and
  16.             ' number of minutes until this session
  17.             ' of Access will be shut down.
  18.             boolCountDown = True
  19.             intCountDownMinutes = 2
  20.         End If
  21.     Else
  22.         ' Count down variable is true so warn
  23.         ' the user that the application will be shut down
  24.         ' in X number of minutes.  The number of minutes
  25.         ' will be 1 less than the initial value of the
  26.         ' intCountDownMinutes variable because the form timer
  27.         ' event is set to fire every 60 seconds
  28.         intCountDownMinutes = intCountDownMinutes - 1
  29.         DoCmd.OpenForm "zzAppShutDownWarn"
  30.         Forms!zzAppShutDownWarn!txtWarning = "This application will be shut down in approximately " & intCountDownMinutes & " minute(s).  Please save all work. There will be no other warning"
  31.         If intCountDownMinutes < 1 Then
  32.             ' Shut down Access if the countdown is zero,
  33.             ' saving all work by default.
  34.             Application.Quit acQuitSaveAll
  35.         End If
  36.     End If
  37.  
  38. Exit_Form_Timer:
  39.     Exit Sub
  40.  
  41. Err_Form_Timer:
  42.     Resume Next
  43. End Sub
Apr 28 '12 #12
kdcrowley
1 New Member
I also use a hidden form to track login info, which also stores a yes/no checkbox, which I can uncheck at anytime. Every 60 sec, the form checks for "loggedIn", and if 0 then opens a warning page. The warning page gives the user 45 sec notice to get out, and then does a DoCmd.Quit acQuitSaveAll. I've considered running code to change (temporarily, of course) that user's login info, so they can't just jump back in, but haven't needed it yet.
Jul 1 '12 #13
ahd2008
68 New Member
That's interesting discussion. Megalog, I am concerned to know what code you use to perform the kick off safely and save the records that are being used when you said " then it saves whatever record they are working, logs them out, and closes access"

Thanks
Jul 2 '12 #14
Megalog
378 Recognized Expert Contributor
After all the checks and measures are done, and the user logging is complete, I believe all it does is:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunCommand acCmdSave
  2. DoCmd.Quit
Jul 2 '12 #15

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

Similar topics

3
2893
by: Sven Jacobs | last post by:
Dear newsgroup, I've upgraded to PEAR::DB 1.6.5 recently. Unfortunately now the database connection doesn't work as expected anymore :( The problems seems to be the method disconnect(), which now closes the database connections of _all_ database objects. I ask myself if this is intentional or a bug. Below a code example: 01 <?php 02   error_reporting(E_ALL);
2
9188
by: Tony Do | last post by:
I have the backup command BACKUP DATABASE NEST TO C:\\databases WITH 2 BUFFERS BUFFER 1024 $ How do I force all the user to disconnect? before running the above command
1
3730
by: Marc Jennings | last post by:
Hi, I need to rebuild a database each time I redeploy a test applicatio, and I was wondering if anyone could give me some clues as to how to go about disconnecting any users that may be logged into that database in SQL. I know I can do this quite easily using MSBuild, but the reason I need to know is so I can get awayt from using beta tools in development. (We have a specific issue with MSBuild) Also, if anyone knows of a good...
4
2472
by: Macca | last post by:
Hi, I have an windows forms application that accesses a SQL database I have a few questions as to connecting to the database. This application will run 24 hours a day. It is a monitoring application and will store events that happen in the database (These events happen randomly without pattern, between 10-50 a day) . There are a number of situations where the database is accessed.
0
3811
by: mamod20 | last post by:
Please advise, I have the following example and want to know the best way to use $dbh->disconnect; and $sth->finish; -------------- $sql_host="localhost"; $sql_dataname = "database"; $sql_userid = "root"; $sql_password = "password"; &connect_sql;
3
45481
by: Laurence | last post by:
Hi there, Does anyone know what's difference among "connect reset", "disconnect", and "terminate"? Thanks in advance,
0
2699
by: raylopez99 | last post by:
10 years ago, the below was written (see very end, after my signature RL). What, if anything, has changed? I have Access 2003 and soon Access 2007 on a Windows XP Professional or Windows Vista Ultimate machine, with SQL Server Express running on it, and I want somebody, with a password (which I will provide) to be able to log onto a A03 or A07 dB from the internet. Now that I type this I realize that unless I put the database onto a...
1
3856
by: TMAG | last post by:
If i do "db2 disconnect all" after an application finishes, does it mean that any application that connects after this will find the buffer pool "cold"? Or the pages accessed by last application will be still in buffer pool? Apparently when I do "db2 disconnect all" at the end, the windows task manager shows that all bufferpool memory has been deallocated. thanks
9
8601
by: Kelii | last post by:
Currently I have a button that allows the user to "Close Company" - at the moment it doesn't do anything :D I would like the button to "disconnect" the back end then show my Open Company form. My question is: 1. Short of closing the application or deleting the linked tables, is there a way to disconnect the user's front end from the common back end using VBA? 2. Does disconnecting the user serve any purpose? I've read a lot of posts...
0
8997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8833
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9389
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8257
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6801
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6079
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4709
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.