Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / August 2006

Tip: Looking for answers? Try searching our database.

kick users off shared database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rob - 30 Aug 2006 18:05 GMT
I came across this code and am trying to use it for my database.  Is a small
database that will track the process of moving code through the SDLC process.
Each time there is movement to testing  an approval is warranted.  There may
be up to 20 or so people using this database at the same time and if I run
into problems and need exclusive rights, I would like to be able to
"kickemoff".  Here is the code that I am using.  

Function fGetOut() As Integer
Dim RetVal As Integer
Dim db As DAO.Database

Dim rst As Recordset
On Error GoTo Err_fGGO
Set db = DBEngine.Workspaces(0).Databases(0)
Set rst = db.OpenRecordset("KickEmOff", dbOpenSnapshot)
If rst.EOF And rst.BOF Then
RetVal = True
GoTo Exit_fGGO
Else
If rst!GetOut = True Then
 'This is where you close down any forms, and quit the database
 'I leave this section as an exercise in creativity
  Application.Quit
Else
 RetVal = True
End If
End If
Exit_fGGO:
fGetOut = RetVal
Exit Function
Err_fGGO:
'Note lack of message box on error
Resume Next
End Function

This is in a module and there is a form that I am told that if I click the
box and hit enter, all users should be knocked out of the database.  Is there
something that I need to add here.  I am getting no error messages, yet the
users are still on when I use the form.
Barry Gilbert - 30 Aug 2006 18:21 GMT
This code checks a value in a table to see if the user should be kicked out.
If it's true, it will quit the app. The trick is that you need to run this
code on the client's machine periodically by using a timer. If you have some
sort of menu/switchboard that cannot be closed, you can use its timer,
otherwise I suggest a sentry form that you open hidden when the app opens and
put the timer there. In the form's OnTimer event, put your code and set the
timer to something like 60000 (one minute), so you're not deluging the
database with too many reads.

The comment in the code that suggests an "exercise in creativity" is
important. If you just quit the app, users will lose any pending work. You
might want to put a messagebox in front of the quit statement that allows the
user to defer the quit for a minute.

Barry

> I came across this code and am trying to use it for my database.  Is a small
> database that will track the process of moving code through the SDLC process.
[quoted text clipped - 35 lines]
> something that I need to add here.  I am getting no error messages, yet the
> users are still on when I use the form.
Rob - 31 Aug 2006 14:55 GMT
Barry:

I have set up a sentry form that is hidden and that is opened when the
switchboard is opened and it remains hidden.  I have put the code in the
timer and have put a message box to alert the users that they will be logged
off.  I assume that by using the "Kick Em Off" form, checking the "Get Off"
box and hitting enter that the code should run from there.  I get no error
messages, but nothing happens.  I don't get my message box.  What could I be
doing wrong?  Do I need to change the code in some way.

Rob

> This code checks a value in a table to see if the user should be kicked out.
> If it's true, it will quit the app. The trick is that you need to run this
[quoted text clipped - 51 lines]
> > something that I need to add here.  I am getting no error messages, yet the
> > users are still on when I use the form.
Roger Carlson - 30 Aug 2006 19:14 GMT
On my website (www.rogersaccesslibrary.com), is a small Access database
sample called "LogUsersOff.mdb" which illustrates how to do this.

Signature

--Roger Carlson
 MS Access MVP
 Access Database Samples: www.rogersaccesslibrary.com
 Want answers to your Access questions in your Email?
 Free subscription:
 http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L

> I came across this code and am trying to use it for my database.  Is a small
> database that will track the process of moving code through the SDLC process.
[quoted text clipped - 35 lines]
> something that I need to add here.  I am getting no error messages, yet the
> users are still on when I use the form.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.