Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Thanked 0 Times in 0 Posts

    Limit access to form (2003)

    I have a form that I would like to limit access to 5 people. I have a table that has these 5 people and a unique identifier for those people. I would like a form to come up (when they click a button on the switchboard) so they can enter this unique id and then have the form (that I want only them to open) come up. Is this possible?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 30 Times in 30 Posts

    Re: Limit access to form (2003)

    It's possible, but it's not very secure - if other users look at the table, they'll see the IDs.

    Let's say the table is named tblSecret, and that the relevant field is a text field named ID.

    You could put a text box txtID on the form, with an appropriate caption for the corresponding label, and a command button cmdOK with caption OK (or Open Form).
    The On Click code for the command button could look like this:

    Private Sub cmdOK_Click()
    Dim varID As Variant
    varID = DLookup("ID", "tblSecret", "ID = " & Chr(34) & Me.txtID & Chr(34))
    If IsNull(varID) Then
    MsgBox "You don't have permission to open the form!", vbCritical
    DoCmd.OpenForm "NameOfSpecialForm"
    End If
    DoCmd.Close acForm, Me.Name
    End Sub

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Crystal Beach, FL, Florida, USA
    Thanked 37 Times in 36 Posts

    Re: Limit access to form (2003)

    As Hans mentioned, your form will only be as secure as that ID table.

    But let's assume that table is secure, in which case you can put an InputBox in the Open event of your secured form, asking for an ID (or password, or whatever). If the user's input doesn't verify, then just set Cancel=True in Open event and form won't continue to open.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  4. #4
    Super Moderator
    Join Date
    Aug 2001
    Evergreen, CO, USA
    Thanked 65 Times in 64 Posts

    Re: Limit access to form (2003)

    Another approachy is to appy Access User Security to the database and require people to login with a password. Then you can modify the menu being displayed so the user never sees the possibility of opening the form, assuming you have some sort of menuing system.

Posting Permissions

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