Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA code to kick off logged users before maintenance 39

Status
Not open for further replies.

Lizard

Technical User
Mar 14, 2001
14
BE
Hi everybody,

I'm regularly faced with the problem that I see users logged on my DB that prevent me from running my daily maintenance because I cannot get exclusive access to the DB.

As I don't have knowledge in VBA, would anybody know where I could find a "plug-and-play" VBA code to allow me to kick out logged users ?

Thanks.

Olivier
 
Hello everyone. I have a question/comment on this method. I too have problems with updating my tables(maint) and have to wait until people get off the db. However when I'm in the db running code sometimes I have a person who opens it up while I'm running code and my program crashes. Is there a way to prevent people from opening while I'm in doing my "housekeeping"?

Thanks, Rib

Bartender:Hey aren't you that rope I threw out an hour ago?

Rope:No, I'm a frayed knot.
 
Hello Rib,

Try incorporating this code into your invisi-form. Of course you have to change a couple of things in there to suit your program:

Private Sub Form_Load()

Dim LOS
LOS = DLookup("[LogOutStatus]", "tblMaintenance")

If LOS = 2 Or LOS = 3 Then
MsgBox "Database is not available at this time."
Quit
End If

End Sub

Hope this helps!
 
Porsche996GT2 said:
If LOS = 2 Or LOS = 3 Then
MsgBox "Database is not available at this time."
Quit
End If

I use a Pop-up form (completely black with a white box in the middle and bold red text) and have the pop-up status checked with every opening of the database.
 
Francescina,

This is an excellent solution to a problem that many administrators would have. I used the post for my database with a few modifications, like:
1. I didn't use a number system. A created a second form so I could create the message when I needed it as well as added a Timer control. This allows me to set the fields in the hidden form to what ever I want. When the timer ticks over, The message appears and the timers form sets to what I wanted. After that time, if the users haven't logged off, they are booted.

You could also set this up for any number of configurations like booting individuals and any criteria that you have set up.

Great post.

I'd give my right arm to be ambidextrous!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top