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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

log user out of database( forcefully) for security

Status
Not open for further replies.

nycdata

Programmer
Jun 28, 2004
26
US

Log user out of the database!!!

Force logout!!

i don't really think im or the admins are going to use it..but incase a wrong person is on the database and if we find out, we would need to force him out...

its all just security purposes..

any help guys??
 
incase a wrong person is on the database
Shouldn't happen if the network and the database are properly secured.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
nycdata

To do this properly, you may want to consider using Access security with group permissions, passwords.

Another way, is to make use of the UserName variable. Have a table with accepted users. If the UserName is not included in the table, they are kicked out.

With the OnLoad event procedure of the Main Menu,

Assumption:
tblEndUser - table of allowed users
AllowedName - field for allowed name

Code:
If Not (DLookUp("[AllowedName]", "tblEndUser", ("[AllowedName] = " & UserName)) Then
   DoCmd.Quit
End If

Richard
 
In deed, why kick a user out if you can prevent him from getting into the database to start with?

I will start by saying that security of Jet data should not be considered infallible, however there are steps you can take to protect your application from 'most' users.

1) Built in security. Like it or love it, there are many opinions on Ms Access's own security methods. Using the wizard, you can create users and groups to have specific permissions on various objects. Some say this is hard to set up, others say it's caused them problems, whilst many have enjoyed it's simplicity and security.

But even with this type of security implemented, your databsae could still be subject to having iyts objects inported into a new DB, or the MDB read with a third party app..

2) Database password. No restrictions once you have the password, but is kind of a brickwall if you don't know it. Personally I don't use this method, as it doesn't allow for multiple users.

3) Create your own.

This is where things can be customised a bit more that the other two, depending a) how much time you have and b) how good your vb skills are.

Assuming both situations are negative, there are 'quick-wins' to achive what you are trying to do.

i) Ensure that you have a form selected to open at startup.
ii) Create a table with one field ("Username") and populate this with each user's NT login, who you wish to allow access to the database.
iii) Put the following code within the On_Open event of that form:

Code:
Dim rs as dao.recordset
Dim strSQL as string

strSQL = "SELECT * FROM tblUsers WHERE Username = '" & Environ("UserName") & "'"
Set rs = Currentdb.openrecordset(strSQL)

If rs.BOF then
docmd.Quit
End If

iv) Change the Windows startup options to hide the database window
v) Change the Windows startup options to disallow the Special Keys, so users cannot press F11 to get to the database window.
vi) Set the AllowByPassKey* property to False (disabled) to prevent the holding of shift when the DB starts up, thus showing the database window, and ignoring your lovely startup form's code.

* there's some great code from MVPS.org for this property... check this link out:
Good luck.. post if you need more help/clarification


------------------------
Hit any User to continue
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top