Results 1 to 6 of 6
  1. #1
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Passwords (2002)

    Hi,

    I presently have a form that has the following code on the open event:

    Dim MyAnswer As String
    MyAnswer = InputBox("Enter Password")
    If MyAnswer <> "brian2" Then
    MsgBox "Password not correct"
    Cancel = True
    End If

    This works fine, but requires me to go behind the scene to change the password. I'd like to be able to have code look to a table to be sure the password is correct. That way the password can be changed in the table. I tried but got an error message.

    Dim MyAnswer As String
    MyAnswer = InputBox("Enter Password")
    If MyAnswer <> [tblPasswords].[AdministratorPassword] Then
    MsgBox "Password not correct"
    Cancel = True
    End If

    I know I can set user permissions, etc. but am trying to find a way past that as inevitably people get locked out who shouldn't. I will resort to that if I need to but would like to try this approach first.

    A related question, if the above is even possible.............can a table be set to only only one record? I'm trying to avoid multiple passwords in some instances.

    Thanks,
    Leesha

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Passwords (2002)

    You cannot use [tblPasswords].[AdministratorPassword]; replace it by

    DLookup("AdministratorPassword", "tblPasswords")

    There is no objection to having a table with a single record.

    By the way, this kind of "security" is never as safe as user-level security. People could look at the table to discover the password.

  3. #3
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Passwords (2002)

    Thanks Hans, that worked great. My plan is to give the user the option of passwords like this or user level security. I plan to use user level security. I realize that people who know how to find the tables can get the info, but its not that likely with this population.

    Leesha

  4. #4
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Passwords (2002)

    Thanks Wendell. I didn't realize Acces keeps track of the last user. How does it do that or how would I access that info?

    Leesha

  5. #5
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Passwords (2002)

    You can find out the current user using the CurrentUser() function.

    You could use this to write records to a log table, when certain events happen.

    As long as one of the user accounts has a password, then users will be prompted with a login screen when they open the database. However each copy of Access remembers the last login userID so individuals will always see their own userID already in this login form when it appears (if they don't share workstations).

    Once Access has closed, it remembers who the last user was. I don't know how to access this info other than by starting Access, and once you do they become the current user.
    Regards
    John



  6. #6
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Passwords (2002)

    Note by the way, with User Security you don't have to have a password, but you do need to know a userID. We often create accounts with no password just so we can track who is using the system - very powerful way of identifying people prone to finger-poking and mouse clicking errors. Access also remembers the last userID used, so unless you are sharing workstations, users don't have to type in anything - just hit the Enter key to begin working.
    Wendell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •