Results 1 to 8 of 8
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    IIF statement (2000)

    I have a password field in a query that has the following criteria: Like IIf([Enter Password]="Darling1","*"," ").
    I would like to add another password so that two people can access this query. How would I do this? Thanks for your help.

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: IIF statement (2000)

    Change your IIF statement to something like this:

    IIf([Enter Password]="Darling1" OR [Enter Password]="Darling2","*"," ").
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

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

    Re: IIF statement (2000)

    Mark's reply will work fine for two passwords. If you would like to extend this to more passwords, the following is slightly easier:

    <code>Like IIf([Password] In ("Darling1","Darling2","OtherDarling"),"*"," ")</code>

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

    Re: IIF statement (2000)

    An additional remark: a construction like this is not really safe. It's fine if you trust the users, but if you really want to keep unauthorized users from seeing all the data, this is not enough. If they can view the design of the query, they can see the passwords, and, even worse, they can view the tables directly from another database. User-level security is the only really good way to restrict what users can see.

  5. #5
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: IIF statement (2000)

    Thank you Mark and Hans for the help.

  6. #6
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: IIF statement (2000)

    I know this isn't really secure but the people that use this database (4 people) were using a spreadsheet to track this data which had no security. This gives them some level of security where they just see their own data and the manager can see everyone. The data entry form is set up (with your help) to just bring up their data. I am always using Access in some way other than what the rules suggest.

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

    Re: IIF statement (2000)

    As long as you're aware of the limitations it's no problem.

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

    Re: IIF statement (2000)

    If you haven't explored the basics of Access User Security, you might want to. For example, doing that would mean that people who worked with the database would only have to put their password in once, and then they would be restricted to their data anytime they ran the query - CurrentUser() is a function that will tell you who is using the database. In addition, you can use that function to automatically put data into the record when it is created so the owner is always identified. Then if you ultimately decide you do want to begin to secure it more, you've done the basic steps. All that's involved is giving the Admin account a password, and creating 4 userids. If you want more details, check out our User Security Tutorial.
    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
  •