Results 1 to 4 of 4
  1. #1
    Join Date
    May 2003
    Posts
    32

    Unanswered: Security to text box, option group or combo box

    I want to be able to password protect certain fields in a form to restrict un-authorized users. I want to protect it when the field get focus. Any ideas?

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    What do you mean by "protect certain fields in a form"?
    Have a nice day!

  3. #3
    Join Date
    May 2003
    Posts
    32
    When the user goes to select a name form a drop down list, I want to be able, once the combo box gets focus for a password to be required to select the name.

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    As with all things security-oriented, how simple or complex this is to implement depends on how important the protection is.

    A simple way to do this is to use a hard-coded password for the control, something like
    Code:
    Private Sub ProtectedControl_Enter()
     PWord = InputBox("Enter Password", "Password")
     If PWord = "Supercalifragilisticexpialidocious" Then
      ProtectedControl.Locked = False
     Else
      ProtectedControl.Locked = True
     End If
    End Sub
    Everyone authorized to make changes to this field would know and use the same password.

    A variation that I used for years in an app, without anyone guessing, was to use the current date, formatted mmddyy. The code would be
    Code:
    Private Sub ProtectedControl_Enter()
      PWord = InputBox("Enter Password", "Password")
      If PWord = Format(Date,"mmddyy") Then
       ProtectedControl.Locked = False
      Else
       ProtectedControl.Locked = True
      End If
     End Sub
    If someone 'shoulder-surfed,' i.e. looked over the user's shoulder to get the password, it would look like it was simply a series of numbers, and the password would change the next day. Not perfect, but I had computer-savvy users trying for years to guess what it was.

    A more complex and therefore safer method would be to use a table, have all authorized users have their own password and do a DLookup() to see if the entered password was a valid one.

    As I said, it all depends on your intent as far as the level of security used.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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