Results 1 to 2 of 2
  1. #1
    Alphavk is offline Novice
    Windows 10 Access 2007
    Join Date
    Oct 2017
    Posts
    7

    How to set exclusive admin right

    Hi all,

    I have the below code to login the database:

    1)can I set right only for "ADMIN" to modify/change design
    2)I don't want users to have the right to change database "Option"

    If anybody can help me to modify the below codes to effect the above changes, will be very much helpful, as I am not familiar with writing codes, as this I copied from another database.
    Thanks in advance..Alpha...
    ====================
    Option Compare Database
    Private Sub Command4_Click()
    'Dim UserLeve As Integer
    Dim dbPassword As String
    If IsNull(Me.UserID) Then
    MsgBox "Please Enter LoginID", vbInformation, "LoginID Required"
    Me.UserID.SetFocus
    ElseIf IsNull(Me.PWord) Then
    MsgBox "Please Enter Password", vbInformation, "Password Required"
    Me.PWord.SetFocus
    Else
    'Process the Job
    If (IsNull(DLookup("UserLogIn", "tblUser", "UserLogIn ='" & Me.UserID.Value & "'"))) Then
    MsgBox "Incorrect username"
    ElseIf (Me.PWord.Value <> DLookup("Password", "tblUser", "UserLogIn ='" & Me.UserID.Value & "'")) Then


    MsgBox "Incorrect password entered"
    Else
    UserLevel = DLookup("UserSecurity", "tblUser", "UserLogIn ='" & Me.UserID.Value & "'")
    DoCmd.Close
    If UserLevel = "Admin" Then
    DoCmd.OpenForm "SWITHBOARD - ADMIN"
    ElseIf UserLevel = "User1" Then
    DoCmd.OpenForm "SWITHBOARD - FH"
    ElseIf UserLevel = "User2" Then
    DoCmd.OpenForm "SWITHBOARD - FK"
    ElseIf UserLevel = "User3" Then
    DoCmd.OpenForm "SWITHBOARD - JS"
    ElseIf UserLevel = "User4" Then
    DoCmd.OpenForm "SWITHBOARD - LG"
    ElseIf UserLevel = "User" Then
    DoCmd.OpenForm "SWITHBOARD - USER"

    End If
    End If
    End If


    End Sub

    Private Sub UserID_Click()
    End Sub
    Private Sub PWord_Click()
    End Sub

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    instead of writing code (that can change) use a table.

    instead of:
    If UserLevel = "Admin" Then
    DoCmd.OpenForm "SWITHBOARD - ADMIN"
    ElseIf UserLevel = "User1" Then
    DoCmd.OpenForm "SWITHBOARD - FH"
    ElseIf UserLevel = "User2" Then
    DoCmd.OpenForm "SWITHBOARD - FK"

    have a table
    [LEVEL], [FORM]
    user2, SWITHBOARD - FK
    user1, SWITHBOARD - FH

    then you can alter the table at will, it will dynamically work for the user, and NO programming.
    user logs in, (code does the lookup and gets the form):

    frm = Dlookup("[form]","tMenuForms","[Level]='" & vUserLevel & "'')
    docmd.openform frm


Please reply to this thread with any new information or opinions.

Similar Threads

  1. I think I'm having Admin Problems
    By jackmackfack in forum Access
    Replies: 3
    Last Post: 04-28-2015, 04:30 PM
  2. HR & Admin Data Tables
    By mba_110 in forum Access
    Replies: 1
    Last Post: 01-16-2015, 11:59 AM
  3. Admin Settings form
    By accessbro in forum Access
    Replies: 1
    Last Post: 08-05-2014, 12:56 AM
  4. MDB Admin
    By marcieldeg in forum Access
    Replies: 5
    Last Post: 03-20-2014, 02:30 AM
  5. Admin Rights
    By Keri in forum Security
    Replies: 4
    Last Post: 11-18-2005, 11:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums