I.T. Discussion Community!
-Collapse +Expand
Search Access Group:

-Collapse +Expand Access To/From
-Collapse +Expand Access Store

Prestwood eMagazine

April Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyMicrosoft Access BoardMS Access Interactive Topic   Print This     

Secure Database

Secure Database in MS Access Interactive topic (part of our Microsoft Access group).

Quick Search: Database   Secure Database  
-- USA
Can I set up a Secure Database where I have five users accessing a table. This table will have information about 12 divisions. Passwords are assigned to the five people whereby the password allows them to either edit or only view the data about the division.
For example:
John can update info about division 1 and division 5 but he has only read-only rights to the rest of the divisions.

If anyone has any suggestions please help me.

 Posted 19 years ago (Thread Starter)
Comment Quote
About lludlow -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #3991, 2 replies
Thread Started 10/5/2001 1:22:00 PM
View Counter=4011
Last Reply Posted 9/20/2010 9:32:51 AM)
Location=-- USA 
Joined=19 years ago   MB Posts=1  
Mike Prestwood
Prestwood IT
Prestwood IT office in Citrus Heights, CA

For lurkers...

Yes, this can be done. It's not automatic however, but not that difficult if you're a programmer. You'll have to do this with code. Usually one would have more than one table to do this. For example, a Users table and a DivisionInfo table. You use the Users table to track, grant, and control rights.

Mike Prestwood
Prestwood IT Solutions

 Posted 10 years ago
Comment Quote
About Mike Prestwood -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
About Mike Prestwood

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains play-drums.com and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Web Presence
Facebook, Prestwood IT Facebook page -- fan page. (Visit Me)
Twitter, Follow Prestwood IT on Twitter. (Visit Me)
LinkedIn, Prestwood IT company page on LinkedIn. (Visit Me)
YouTube, Prestwood IT YouTube Channel (Visit My Channel)
Website, My drum website where I sell my drum books. (http://www.play-drums.com)

Post ID #14075 (Level 1.1)  Reply to 3991
Thread Started 5/9/2010 8:30:53 AM
Location=Prestwood IT office in Citrus Heights, CA 
Joined=20 years ago   MB Posts=1410   KB Posts=1805   KB Comments=69   BLOG, Topics=4  
Most Recent Post
Tupelo, MS

When my users open an Access database, they don't login to MS Access using the security built into MS Access.  They have already logged into the network and workstation with their credentials, so I just use those.

I use a vba function to determine their windows username.  Then I look up that username in my table of rights/restrictions and enable/disable whatever I need based on who they are.

I keep them captive in forms (or reports).  It GREATLY reduces problems.

Also, it is a good practice when multiple people share a networked access database to separate your GUI from your Data by splitting the file.  It greatly reduces the chance of file corruption and unlocks the GUI for development without having to lock everyone out while you work!



P.S.  I almost forgot to add the vb code.  Here it is...

Option Compare Database
Option Explicit

' In the Declarations section
Declare Function GetComputerName& Lib "kernel32.dll" _
                         Alias "GetComputerNameA" (ByVal lpBuffer As String, _
                         nSize As Long)                                        ' Network CPU Name

Declare Function GetUserName& Lib "advapi32.dll" _
                        Alias "GetUserNameA" (ByVal lpBuffer As String, _
                        nSize As Long)                                         ' Network login name

Public Const MAX_COMPUTERNAME_LENGTH = 15                        ' Varies with platform OS
Function sGetUser() As String                             ' Returns current network logon
'   Usage:      ="Network User Name: " & sGetUser()
    Dim s$, cnt&, dl&, sWho As String
    cnt& = 199
    s$ = String$(200, 0)
    dl& = GetUserName(s$, cnt)
    sGetUser = Left$(s$, cnt - 1)
End Function

Function sGetComputer()                                   ' Returns network name of computer
'   Usage:      ="Computer Name: " & sGetComputer()
    Dim s$
    s$ = String$(MAX_COMPUTERNAME_LENGTH + 1, 0)
    Dim dl&
    Dim sz&
    dl& = GetComputerName(s$, sz)
    sGetComputer = Left$(s$, sz)
End Function

Public Function sGetUserID()                              ' Currently (Access) logged user
'   Usage:      ="Access User ID: " & sGetUserID()
    sGetUserID = CurrentUser()
End Function

Function getlevel()
    Dim rstUsers As ADODB.Recordset
    Set rstUsers = New ADODB.Recordset
    Dim ulevel As String
    Dim errLoop As Error
    Dim selstr As String
    selstr = "SELECT username, accesslevel FROM users where username = '" & sGetUser() & "'"
    rstUsers.Open selstr, CurrentProject.Connection
     On Error GoTo linenext
    ulevel = rstUsers.Fields("AccessLevel")
    Set rstUsers = Nothing
    getlevel = ulevel
End Function

 Posted 10 years ago
Comment Quote
About dmichael -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #14294 (Level 1.2)  Reply to 3991
Reply Posted 9/20/2010 9:16:11 AM
Location=Tupelo, MS  
Joined=19 years ago   MB Posts=18  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.

Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P195A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #3991 Counter
Since 4/2/2008

Follow PrestwoodBoards on: 

©1995-2020 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech