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

"kicking" users from a database

Another Q,

Because we sometimes need to repair the shared database I would like
to find out if there is a way to "kick" all users from a database. The
problem is that I cannot repair the database when it is beeing
accessed by another user and this almost always seems to be the case.
With another tool I downloaded I can identify the users still in the
database and send them a NET message to exit the DB.

Does anyone know how I can do this programmatically, or if I can deny
users access to the database for a while?

thx, Seansan
Nov 13 '05 #1
4 2478
seansan wrote:
Another Q,

Because we sometimes need to repair the shared database I would like
to find out if there is a way to "kick" all users from a database. The
problem is that I cannot repair the database when it is beeing
accessed by another user and this almost always seems to be the case.
With another tool I downloaded I can identify the users still in the
database and send them a NET message to exit the DB.

Does anyone know how I can do this programmatically, or if I can deny
users access to the database for a while?


Common approach to this is to have a form open, but hidden; the form has
a Timer event, and checks on every timer for a certain condition (some
file on the network exists, or some record exists in some table--you can
use that if tables sit in a backend on a shared location). If the
condition applies, display a message and issue a Quit statement.
--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #2
> Does anyone know how I can do this programmatically, or if I can deny
users access to the database for a while?


There's no built-in way to do this, so you have to code your own
method. Basically, what you would want to do is:

Create a table that's going to let you know whether access is allowed.
Call it USys-something, because the database will hide it, even if
you check 'show hidden objects.' It won't confuse anyone, and nobody
will know to tamper with it. You could either just have one row with
a yes/no field, or a history and scheduler.

Then on each form and report, have a function that checks your table,
and closes the database if you've put it off limits. Call your
function when the form loads, and probably on a timer.
Nov 13 '05 #3
I have been doing that for a couple of years on a system in our
factory. I have the main menu check once per minute for an entry in a
table that says that I need the database. When each user's code
detects the flag, a routine closes all the forms except the main menu
and a dialog box is displayed explaining the situation. The main menu
does not access any tables so I am free to do whatever maintenance is
required.
I prefer this method as opposed to shutting down their
application because then the user would not know exactly what has
happened. The dialog box stays up, the flag is checked again, once
per minute, and when the condition changes, the dialog box is closed
and the user can continue at will.
I use the following code to close all forms. There are probably
better ways but this works.

Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentProject
' Look for open forms
For Each obj In dbs.AllForms
If (obj.IsLoaded) Then
strName = obj.Name
' Close all open forms except "Main Menu" and "QuitForm"
If ((strName <> "Main Menu") And (strName <> "QuitForm")) Then
DoCmd.Close acForm, strName, acSaveYes
End If
End If
Next obj
Nov 13 '05 #4
Hank Reed wrote:
I have been doing that for a couple of years on a system in our
factory. I have the main menu check once per minute for an entry in a
table that says that I need the database. When each user's code
detects the flag, a routine closes all the forms except the main menu
and a dialog box is displayed explaining the situation. The main menu
does not access any tables so I am free to do whatever maintenance is
required.
I prefer this method as opposed to shutting down their
application because then the user would not know exactly what has
happened. The dialog box stays up, the flag is checked again, once
per minute, and when the condition changes, the dialog box is closed
and the user can continue at will.
I use the following code to close all forms. There are probably
better ways but this works.

Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentProject
' Look for open forms
For Each obj In dbs.AllForms
If (obj.IsLoaded) Then
strName = obj.Name
' Close all open forms except "Main Menu" and "QuitForm"
If ((strName <> "Main Menu") And (strName <> "QuitForm")) Then
DoCmd.Close acForm, strName, acSaveYes
End If
End If
Next obj


You're too kind to your users, I give users plenty of warning by use of
the polled table mentioned elsewhere in this thread, then if they're
still in then tough titty, they should know better than to defy me :-)

Actually it's defying the client's admin bod, but I give him the means
to do it and the "Kick Users" button has been renamed "Kill Users" by
request from one of them, something I gladly complied with, didn't even
charge him for that one.

--
This sig left intentionally blank
Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Follower | last post by:
Hi, I've run into an issue which seems to have been discussed previously on `python-dev` but only in context of Zope3: "Fun with 2.3 shutdown" -- Tim Peters...
0
by: Anthony Baxter | last post by:
To go along with the 2.4a3 release, here's an updated version of the decorator PEP. It describes the state of decorators as they are in 2.4a3. PEP: 318 Title: Decorators for Functions and...
8
by: Hostile17 | last post by:
Consider the following HTML. ---------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> <html> <head> <meta...
11
by: Daniele Benegiamo | last post by:
Is the following program standard-compliant? I've compiled it with some compilers and no errors or warnings are produced, but this is not a demonstration. The "incriminated" part is the...
6
by: Tom Kaminski [MVP] | last post by:
I can do this in ASP, but not sure how to handle in ASP.NET: How To Use the ADODB.Stream Object to Send Binary Files to the Browser through ASP http://support.microsoft.com/?kbid=276488 Do I...
2
by: Jeff_Mac | last post by:
Hi there. I'm a bit of a newbie, and I would appreciate any help that anyone can give me on an error I'm getting with Crystal Reports. Every time I attempt to view a report using the Crystal...
30
by: bblais | last post by:
Hello, Let me start by saying that I am coming from a background using Matlab (or Octave), and C++. I am going to outline the basic nuts-and-bolts of how I work in these languages, and ask for...
5
by: Duderino82 | last post by:
I'm working on a very simple peace of php where basically there is a form and 3 buttoms. One refreshed the page, one posts the form, and another one (since this form contains values of a record)...
9
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. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.