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!

Security - limit access to forms within db

Status
Not open for further replies.

cft

Technical User
Dec 4, 2001
7
US
I have a database in which I would like to have a Password as the "gatekeeper" to forms within the database. When a particular form is selected from the Switchboard I would like it to request a password that is selected by the primary user of that form. This is an accounting database and it needs a variety of access levels, so developing security thru the usual path seems inefficient. Is there a simple way to limit access to forms from within the db?
 
There are several things you can do. I don't know how much experience you have, but I will start from the easy (less secure) level and work my way up.

1. Click on tools and click on start-up. Set which form you want to start and disable some of the features like the full database window etc. Of course everyone and their brother who has worked a little with Access will get to your data pretty easily. But for the illiterate, it is not bad.

2. Create a start-up form and disable the shift-key by inserting the code in a module. Make a login form and disable full menus and database windows. If I remember correctly, look up Help in Access and search for "allowkey". Hide your tables in another folder and with a new BE database. Change the BE (back-end) db extension from .mdb to doc. This way no one will see your BE. Remember to set your allowkey = true in your db somehow so that you the owner can get back in. Otherwise you will be in deep duduu.

3. Then of course you can set up security (what a hassle) in the tools option. Good luck with this one. Especially when you have many users scattered throughout a huge building.

cheers and happy Access
 
Hallo,

This may be useful. It's a function which returns the login name of the current user:

Code:
'The GetUserName function retrieves the user name of the current thread, the user currently logged onto the system
Public Declare Function lngGetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function strGetUserName() As String
On Error GoTo Err_strGetUserName
  
  Const cintBufferLength As Integer = 255
  Dim strBuffer As String * cintBufferLength
  Dim lngSize As Long

  lngSize = cintBufferLength

  If lngGetUserName(strBuffer, lngSize) <> 0 Then
    strGetUserName = left$(strBuffer, lngSize - 1)
  Else
    strGetUserName = &quot;&quot;
  End If

Exit_strGetUserName:
  Exit Function
Err_strGetUserName:
  strGetUserName = &quot;&quot;
  Resume Exit_strGetUserName
End Function

It works for NT and Windows 98SE.
Once you know the user's name, you can put in checks in forms you don't want them to open so that they can't, or disable buttons, make tabs invisible, whatever.
This would be good used in conjunction with robmoors ideas.

- Frink
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top