Page 2 of 2 FirstFirst 12
Results 16 to 24 of 24

Thread: Restricting User Access

  1. #16
    WayneSteenkamp is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    107
    here's a copy of the DB

    FYI
    The two txt boxes there (which might be blank yourside) gather the user name and access level
    The listbox contains a link to the form/report depending on the user level

  2. #17
    June7's Avatar
    June7 is online now Moderator
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    24,226
    It grabbed my system id and of course assigned level 1. There aren't any item 1's in lstMenu so I had nothing to select. Added my ID as Admin in tblStaff.

    I changed the event to AfterUpdate. Works great.
    To provide db: Make copy, remove confidential data, run compact & repair, zip if large - 2mb allowed, attach to post. Attachment Manager is below the Advanced post editor window.
    If suggestion in this post resolves your issue, please use the Thread Tools and mark the thread as Solved!

    Debug!Debug!Debug! http://www.cpearson.com/excel/debug.htm

  3. #18
    WayneSteenkamp is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    107
    yeah it works fine

    Think your able to help me with the amendments?

    I just want the restricted users to have access to ASE_Units_form. And within the form I want them only to be able to edit/have access to the:
    Location
    DBA
    SiteName
    DateInstalled
    and Repair History (subform)

    The rest need to be locked.

  4. #19
    June7's Avatar
    June7 is online now Moderator
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    24,226
    Amendments of what to what? Are you talking about buttons instead of the listbox?

    Oh, you must mean the limitations on the ASE_Units_form.

    Use that form's Open event and set Visibility or Enabled property.
    Code:
        Select Case iAccess
            Case 1
                Me.controlname1.Enabled = False
                Me.controlname2.Enabled = False
                ...
            Case 2
                'something here?
            Case 3
               'do nothing, full rights
        End Select
    To provide db: Make copy, remove confidential data, run compact & repair, zip if large - 2mb allowed, attach to post. Attachment Manager is below the Advanced post editor window.
    If suggestion in this post resolves your issue, please use the Thread Tools and mark the thread as Solved!

    Debug!Debug!Debug! http://www.cpearson.com/excel/debug.htm

  5. #20
    WayneSteenkamp is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    107
    ok i'll try that. Thanks

    Yes i meant the buttons instead of the listbox as well.

  6. #21
    WayneSteenkamp is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    107
    Hey June!

    The coding you gave me worked great for the buttons on the Main_Menu.
    The tried using the same code in the ASE_Units_form to disable some of the fields in there (open event). I couldn't get it to work. Can the coding be used for buttons and Fields?

    Want the code to work for a "code 2" user

  7. #22
    June7's Avatar
    June7 is online now Moderator
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    24,226
    Yes, can use code on buttons and data controls.

    It isn't working because turns out iAccess is a local variable. That means it has a life only in the Load procedure of Main_Menu where it is declared. When the procedure completes the variable is dropped from memory. I did ask some time ago what iAccess is. So, my suggestion (and what I use) is to set a textbox on Main_Menu to the permissions value. Main_Menu remains open at all times so the value is always available for reference.

    Add this line into the header of all modules (just below Option Compare Database): Option Explicit. This will demand that all variables be declared somewhere with a Dim statement. It will help in debugging issues like this.
    To provide db: Make copy, remove confidential data, run compact & repair, zip if large - 2mb allowed, attach to post. Attachment Manager is below the Advanced post editor window.
    If suggestion in this post resolves your issue, please use the Thread Tools and mark the thread as Solved!

    Debug!Debug!Debug! http://www.cpearson.com/excel/debug.htm

  8. #23
    WayneSteenkamp is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    107
    Quote Originally Posted by June7 View Post
    So, my suggestion (and what I use) is to set a textbox on Main_Menu to the permissions value. Main_Menu remains open at all times so the value is always available for reference.
    sorry, I didnt know it was local
    I get what your saying. but how do i do that exactly? or can you send the attachment over? This DB has been given me a headache for the past few days. Thanks for your help and patience

  9. #24
    June7's Avatar
    June7 is online now Moderator
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    24,226
    You seem to already have a textbox on Main_Menu and the code in load event to populate. Now refer to that textbox in place of iAccess in the ASU_Units form code: Forms!Main_Menu.txtLevel
    To provide db: Make copy, remove confidential data, run compact & repair, zip if large - 2mb allowed, attach to post. Attachment Manager is below the Advanced post editor window.
    If suggestion in this post resolves your issue, please use the Thread Tools and mark the thread as Solved!

    Debug!Debug!Debug! http://www.cpearson.com/excel/debug.htm

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 13
    Last Post: 11-18-2013, 12:20 PM
  2. restricting access until logged in
    By gbmarlysis in forum Security
    Replies: 1
    Last Post: 02-17-2012, 04:43 PM
  3. Restricting Access Form Textbox to Text only.
    By Accession in forum Programming
    Replies: 4
    Last Post: 09-30-2011, 12:51 PM
  4. access restricting users
    By jmskms in forum Access
    Replies: 2
    Last Post: 03-05-2010, 06:39 AM
  5. Replies: 0
    Last Post: 03-26-2008, 07:46 PM

Posting Permissions

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