Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2005

    Unanswered: Password protection

    I have a set of command buttons on a form that open up a series of reports. The problem I have is that only certain users should have access to particular reports and I want to be able to put some kind of password protection in.

    If anyone knows how to do this please let me know.


  2. #2
    Join Date
    Apr 2004
    outside the rim
    The simplist, since you already have the form with command buttons, is to put in the code for the "secure" command buttons an InputBox requesting the password. InputBox is a simple message box that prompts the user for a typed input. You then chack that against a known value to see if it is valid. Access help has sufficient information to show use of this command.

    From here, you can start going into all kinds of directions to make it more, shall we say, professional.

    Such as:
    1) Use a popup form instead of the InputBox command, since a popup can be completely customized, including setting the text box input mask to "Password", which gives you the *** as you type.

    2) Use an internal table to hold the password, so that you can change it later.

    3) Use the API call to identify the login ID of the current user. With this, you can have a table setup to identify if the user is allowed to have that report or not, thereby skipping the password altogether (since a password is useless once it's figured out).

    4) Again, using the API to ID the user, you can disable the controls they are not allowed to use when the form opens. A quick way to do this is by using the Tag property, and a 'For Each Control ... Next loop'.

    There are probably about thousand other ways to do this.
    have fun!

    Todd S.
    click to email

    Independent Development Consultant
    Biz db & reports - SQL, Access, Crystal, Seradex and more
    Small, custom, unique programs - Office, VBA, .NET

    Favorite message from Windows:
    There was an error displaying the previous error message

    Sadly, there was no error number to look up ...

  3. #3
    Join Date
    Jul 2004
    You could set up user levels. Each level has a certain amount of privileges, for example:

    1 = Admin
    2 = Moderator
    3 = power user
    4 = user

    Each level has more privileges than the previous (but includes the privileges of the lower level(s))

    Then you just have to do an IF userlevel>="RequiredLevel" Then {open form} Else {load an error screen}

Posting Permissions

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