How to show available forms and controls for a specific operator after login?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ryno Bower
    New Member
    • Nov 2010
    • 76

    How to show available forms and controls for a specific operator after login?

    Hello. I want to integrate roles and permissions for a specific operator after they log in. Is there a way to handle this. If so please ldt me know and ill give more details. Please answer. Thanks. Ryno
  • hype261
    New Member
    • Apr 2010
    • 207

    #2
    The way I have done this in the past is to create a field in my Users table called Role. Then I just do a query off the role field and check to see if they have that Role before letting them open a form or update some information.

    Comment

    • Ryno Bower
      New Member
      • Nov 2010
      • 76

      #3
      Ok. Do you maybe have a sample databare how you did it. My goal is to set up a list of roles an then tick them off which access the user has.

      Comment

      • hype261
        New Member
        • Apr 2010
        • 207

        #4
        Sadly I can't provide any samples because I did them for work, but I can give a clearer explanation. So I have a table Users with the following fields.

        NetworkName, FullName, Role

        When the User launches the application on the first form they see in the On Open event I run a query similar to this one.

        Select FullName, Role FROM Users where NetworkName = '" & Environ("UserNa me") & "'";

        If they don't exist in the Users table then I kick them out of the application and tell them to contact me.

        On the first form I have two hidden text boxes called tbFullName and tbRole. Once I have gotten the result of the query I load these text boxes up with the information. This first form stays open the entire life of the application so any time I need to check their role I just check the text box and see what it is.

        Hope this helps.

        Comment

        • Ryno Bower
          New Member
          • Nov 2010
          • 76

          #5
          Ok, so is there certain buttons that they cant use if they dont have access to it. For e.g. In a purchase order, if they are a buyer, they can create a p/o and if there is a button to approve the po its disabled because only a manager can approve orders. Do you understand where im coming from. I want to grant users different access.

          Comment

          • hype261
            New Member
            • Apr 2010
            • 207

            #6
            In that situation I would have some code in the Forms on Open event like this. I am assuming the names of your roles and your buttons

            Code:
            If(Forms!frm_MainMenu.tbRole = "Manager") Then
                me.btnApprove.Enabled = true
            Else
                me.btnApprove.Enabled = false
            End if

            Comment

            • Ryno Bower
              New Member
              • Nov 2010
              • 76

              #7
              Can you maybe attach a sample database? I need to see this practically to understand it. Please. Thanks

              Comment

              Working...