Kicking users off a shared database 
Author Message
 Kicking users off a shared database

Does anyone know of a way in Access 2.0 to kick users off a shared
database.  I want an Admin to do scheduled routines such as compacting
the database.  However, you cannot compact a database unless you have
exclusively opened it.  I want to send warning messages to all users
connected to the shared database and then kick them off if need be.  
Anyone have any suggestions.  Thanks in advance.  John.



Tue, 31 Aug 1999 03:00:00 GMT  
 Kicking users off a shared database

Quote:

>Does anyone know of a way in Access 2.0 to kick users off a shared
>database.  I want an Admin to do scheduled routines such as compacting
>the database.  However, you cannot compact a database unless you have
>exclusively opened it.  I want to send warning messages to all users
>connected to the shared database and then kick them off if need be.  
>Anyone have any suggestions.  Thanks in advance.  John.

I do it all of the time.  When the user opens the database, they look
at a LOGOUT table which I mark to denote if they can login.  A form
runs which checks this table status every minute.  If it is marked, no
one can login and everyone is automatically logged out.  Users have
Read-Only permissions on this table so they can't change it on their
own.

Use the Timer event to check your table from a hidden form.

Patrick Thornburg
LAPI Software



Tue, 31 Aug 1999 03:00:00 GMT  
 Kicking users off a shared database

John,

You will have to use your Network Operating System to do that.  Access
provides nothing of that sort.

Igor Papirov
MCSD
Contract Programmer
Chicago, IL



Quote:
> Does anyone know of a way in Access 2.0 to kick users off a shared
> database.  I want an Admin to do scheduled routines such as compacting
> the database.  However, you cannot compact a database unless you have
> exclusively opened it.  I want to send warning messages to all users
> connected to the shared database and then kick them off if need be.  
> Anyone have any suggestions.  Thanks in advance.  John.



Wed, 01 Sep 1999 03:00:00 GMT  
 Kicking users off a shared database

Hi,

        Just a thought. Write module KickemOff() which is triggered when the DB receives the Compact call. You can then do a msgbox (whatever
you want to tell them), a save, then a quit.

        You'd probably have to set the code in every form. Unless there are application events. And that I don't know about.

        THe best way is probably to set a global variable LOCK_APP and set it to false, then when to want to compact the db, have you logon
script check this value, and if this value is true, then don;t allow new users to logon. Then have the timer event check this value also and
when its true, quit the app. This would probably be the best way around it. I'd have to look into event properties more.

        But will there's a will there's a way, even if not very elequent. I love having people tell me *you can't do that with Access or VBA*
just to turn around and do it anyway <smirk>.

Good Luck




Fri, 03 Sep 1999 03:00:00 GMT  
 Kicking users off a shared database

Quote:
>Write module KickemOff() which is triggered when the DB receives the

Compact call.

Excuse me, but what is this "Compact call" event you mention that is
supposed to fire in a database?   I have to admit that I've never heard of
it.

john k



Quote:
> Hi,

>    Just a thought. Write module KickemOff() which is triggered when the DB

receives the Compact call. You can then do a msgbox (whatever
Quote:
> you want to tell them), a save, then a quit.

>    You'd probably have to set the code in every form. Unless there are

application events. And that I don't know about.
Quote:

>    THe best way is probably to set a global variable LOCK_APP and set it to

false, then when to want to compact the db, have you logon
Quote:
> script check this value, and if this value is true, then don;t allow new

users to logon. Then have the timer event check this value also and
Quote:
> when its true, quit the app. This would probably be the best way around

it. I'd have to look into event properties more.
Quote:

>    But will there's a will there's a way, even if not very elequent. I love

having people tell me *you can't do that with Access or VBA*
Quote:
> just to turn around and do it anyway <smirk>.

> Good Luck





Sat, 04 Sep 1999 03:00:00 GMT  
 Kicking users off a shared database

John,

You can do it from within Access, but it needs some programming.

1.      Create a hidden form with a timer event opened at startup
2.      Timer event checks for a value in a table that can be set by your Admin
3.      Normally this check will exit without action
4.      If logoff is required, Send user a polite message box and set another
        timer event waiting giving users a few minutes to complete actions.
5.      Close all open forms tidily and Quit.

As I say, It needs a bit of work, but it does the job...

Gerry Copland



Quote:
> Does anyone know of a way in Access 2.0 to kick users off a shared
> database.  I want an Admin to do scheduled routines such as compacting
> the database.  However, you cannot compact a database unless you have
> exclusively opened it.  I want to send warning messages to all users
> connected to the shared database and then kick them off if need be.  
> Anyone have any suggestions.  Thanks in advance.  John.



Tue, 07 Sep 1999 03:00:00 GMT  
 Kicking users off a shared database

Actually, neither of these approches will really work. The first one won't
work, because the database does not really receive a Compact call, when one
workstation tries to compact the database, if there are any users logged
into the .LDB, it simply fails the compact action, and no information about
it goes to the other users or even to the database. Global Variables would
need to be changed from within the current Connection to access, so another
user on a different workstation (you, the dba, on your machine) cannot
change the value of a global variable on another workstation (the goober on
the 3rd floor of the other building all the way across the office campus
who left his machine on and in the database all night long).
What will work:
Create a table in the database called "KickEmOff" containing one field,
"GetOut", integer value, default 0. Create a function that gets called from
a Timer Event on a form that is always up in the application. Function
follows. Note lack of Message boxes because you're executing this "GetOut"
at 12 Midnight, and the user is not at his/her desk to respond to any
message box that would effectively stop the execution of this function, and
thus stop his/her exiting the database. If you want to be nice, bring up a
small modal form that displays the text "You are being booted from the
database. Auto Exiting in 10... 9... 8... " that gets closed just before
everything exits.

Function fcnGottaGetOut()As Integer
Dim RetVal As Integer
Dim MyDB As Database
Dim MyRS As Recordset
On Error Goto Err_fGGO
Set MyDB = DBEngine.Workspaces(0).Databases(0)
Set MyRS = MyDB.OpenRecordset("KickEmOff", db_Open_Snapshot)
If MyRS.EOF and MyRS.BOF Then
        RetVal = True
        Goto Exit_fGGO
Else
        If MyRS!GetOut = True Then
                'This is where you close down any forms, and quit the froggen database
                'I leave this section as an exercise to the creative readers
        Else
                RetVal = True
        End If
End If
Exit_fGGO:
        fcnGottaGetOut = RetVal
        Exit Function
Err_fGGO:
        'Note lack of message box on error
        Resume Next
End Function

Now, as the responsible DBA, you simply enter a record into "KickEmOff"
with a GetOut value of True (-1) and watch em all bail out like flies. The
fastest way I've found to determine if they're all out is if you can delete
the .ldb file. Then compact. Then enter the database and delete that record
from KickEmOut, or else nobody will be able to work in the database, and
they'll all be out for {*filter*}...

-Steve

In order to boot 'em out, and keep 'em out, just enter a record in


Quote:
> Hi,

>    Just a thought. Write module KickemOff() which is triggered when the DB

receives the Compact call. You can then do a msgbox (whatever
Quote:
> you want to tell them), a save, then a quit.

>    You'd probably have to set the code in every form. Unless there are

application events. And that I don't know about.
Quote:

>    THe best way is probably to set a global variable LOCK_APP and set it to

false, then when to want to compact the db, have you logon
Quote:
> script check this value, and if this value is true, then don;t allow new

users to logon. Then have the timer event check this value also and
Quote:
> when its true, quit the app. This would probably be the best way around

it. I'd have to look into event properties more.
Quote:

>    But will there's a will there's a way, even if not very elequent. I love

having people tell me *you can't do that with Access or VBA*
Quote:
> just to turn around and do it anyway <smirk>.

> Good Luck





Sun, 12 Sep 1999 03:00:00 GMT  
 Kicking users off a shared database

Quote:
>'This is where you close down any forms, and quit the froggen database
>'I leave this section as an exercise to the creative readers

Darn, and this was the part I wanted to see a sample for!  Depending on
what's lying about in the application this could be tricky, no?

john k



Mon, 13 Sep 1999 03:00:00 GMT  
 Kicking users off a shared database

Hi John,

The syntaxt will be an Application.Quit, but you are right, if a form
refuse to close ( a dirty record cannot be save, the form won't close; or
explicitely Cancel its onClose event if a specific condition is not met),
but as you said, this is almost a case by case situation. There is no
"general" procedure, just the way to begin it.

Note this seems more problematic in Access 97, since it seems you will have
to close all the recordset and set to nothing all objects, too. So you
probably want a general subroutine where you will centralize all that
clenaing stuff and it will be that subroutine that will call itself the
Application.Quit.

Hope it may help,
Vanderghast, Access MVP.



Quote:
> >'This is where you close down any forms, and quit the froggen database
> >'I leave this section as an exercise to the creative readers

> Darn, and this was the part I wanted to see a sample for!  Depending on
> what's lying about in the application this could be tricky, no?

> john k



Tue, 14 Sep 1999 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Kicking users off a database

2. Kick off unix script from access

3. kicking off an Access macro from Outlook

4. Kick off Mailmerge when doc is opened

5. kicking off a vbscript from a hyperlink

6. Kicking off DOS commands in VB4

7. Kicking off DOS commands in VB4

8. kicking off a vbscript from a hyperlink

9. Inet StateChanged Sub isn't being kicked off

10. Need to kick off a process and wait for it to finish in VB

11. Share Kick?

12. Logging Users off an Access Database

 

 
Powered by phpBB® Forum Software