Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2004
    Posts
    34

    Unanswered: How to get and store ID and PW from a form at program open

    I have a chem lab Access database that does not need serious security, but rather minor security. Currently, it is set that when a form opens that needs security, a box opens with a spot for Login ID and Password. If the two match an entry in a table and their security level is enough (user, supervisor, or admin), then the form opens showing only that user's information.

    This has worked fine for now and has allowed the database to be used. However, I am now in the fixing up process and would like to streamline the login process. Instead of having a person log in each time a form is opened, I would like to have the login screen come up after the program opens, then after the ID and PW are entered and cleared, the program will store the ID and make the menu items he or she has access to the only ones available. When a form is opened, it will list only that person's info.

    I'm pretty sure that this involves using a module, but I have never used modules before (self-taught Access user). I think what needs to happen is that the ID number needs to be stored for future reference, then my forms would just retrieve that ID and display the correct info. I have Yes/No boxes for each security level, so the code would reference that and only make the appropriate menus available, but I'm not sure how to do that either. Any help to get me in the right direction would be great. If more info is needed, let me know.

    David

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    you can get the user to log on, and store the userid or security in a global variable.. or use the currentuser() function if you get the user to authenticate on first opening the Access db.

    have you considered by passing the need to request a user id, and instead pull the userid from the network user.. its not appropriate for all cases.. but can save a fair bit of effort. have a look in the code bank or look for Dev Ashish's API calls on google

  3. #3
    Join Date
    Jul 2004
    Posts
    34
    Using the network ID would work if there weren't shared computers where multiple people are working on one computer (these are QA labs). I'll look into using what you suggested. May take me awhile to figure it out, but if I do, I'll post the result. Thanks again.

    David

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Create a new module called "Global Variables" and write the following
    Code:
    Public currentUser As String
    then when the app opens, simply assign a value to the variable
    Code:
    currentUser = Me.txtUsername.Value
    George
    Home | Blog

Posting Permissions

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