Security Control To Certain Users In Ms Access

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kartikss
    New Member
    • Apr 2007
    • 25

    Security Control To Certain Users In Ms Access

    I Have Created A Table & Form : Named : "Security Control" : Field Having

    User Id - Text (pk)
    Password - Text
    Data Entry Enable - Yes / No Option
    Report Enable - Yes / No Option

    And

    I Have Another Form : Named "Login"

    Field Having

    User Id And Password

    I Am Trying To Pick Up User And Password From Security Control And If It Matches Then It Should Continue Along With Setting I have given To That User Else It Should Give An Error.

    How Do I Work On It?

    Everything Is In Ms Access

    Thanks & Bye

    Kartik
  • kartikss
    New Member
    • Apr 2007
    • 25

    #2
    Originally posted by kartikss
    I Have Created A Table & Form : Named : "Security Control" : Field Having

    User Id - Text (pk)
    Password - Text
    Data Entry Enable - Yes / No Option
    Report Enable - Yes / No Option

    And

    I Have Another Form : Named "Login"

    Field Having

    User Id And Password

    I Am Trying To Pick Up User And Password From Security Control And If It Matches Then It Should Continue Along With Setting I have given To That User Else It Should Give An Error.

    How Do I Work On It?

    Everything Is In Ms Access

    Thanks & Bye

    Kartik
    Here Data Entry Enable and Report Enable should function in such a way when i say "No" to Data Entry Enable and Report Enable , then it should be disable those command buttton and if i say "Yes" to Data Entry Enable and Report Enable , then it should be enable those command buttton.

    So how do work on it?

    Thanks & Bye

    Kartik

    Comment

    • MMcCarthy
      Recognized Expert MVP
      • Aug 2006
      • 14387

      #3
      Code:
      Private Sub Login_Click()
      Dim userName As String
      Dim pswd As String
      
         userName = nz(DLookup("[User Id]", "Security Control", "[User Id]='" & Me![User Id] & "'"), "")
         If userName = "" Then
      	  Msgbox "You haven't entered a valid User Id", vbOkOnly
      	  Exit Sub
         End If
      
         pswd = nz(DLookup("[Password]", "Security Control", "[User Id]='" & userName & "'"), "")
         If pswd <> Me!Password Then
      	  Msgbox "You haven't entered a valid Password", vbOkOnly
      	  Exit Sub
         End If
      
         ' open menu/switchboard form here.
      
      End Sub

      Comment

      Working...