Results 1 to 4 of 4
  1. #1
    Join Date
    May 2012

    Unanswered: Unlock Password Protected fields from a button

    Hi all,

    I have created a form for viewing records. I want other people to not be able to make changes, therefore i have locked the fields.

    I am using a crude password system to unlock all fields when clicking a button.

    I have successfully done this before on a single field click event. When you click, you are prompted to enter a password and if correct, the field unlocks for editing.

    I am hoping to do the same thing but have one button unlock all the fields. For some reason my code wont work, I think its related to trying to do multiple commands at once or something. My vb is a bit rusty and I am confusing myself with c#.

    Can anyone help me. Thanks

    Private Sub Admin_Edit_Click()
    Dim adminpw As String
    adminpw = InputBox("Enter Admin Password", "Admin Only!")
    If adminpw = "AdminPassword" Then
    Me![Product Name].Locked = False
    Me![Product Code].Locked = False
    Me![Document Name].Locked = False
    Me![DS Number].Locked = False
    Me![Edition].Locked = False
    Me![Last Updated].Locked = False
    Me![Change Log].Locked = False
    Me![Product Name].Locked = True
    Me![Product Code].Locked = True
    Me![Document Name].Locked = True
    Me![DS Number].Locked = True
    Me![Edition].Locked = True
    Me![Last Updated].Locked = True
    Me![Change Log].Locked = True
    MsgBox "Field Can Only Be Edited by Admin", vbExclamation, "Admin Only!"
    End If
    End Sub
    You can use statistics to prove anything - 78% of people know that!

  2. #2
    Join Date
    Feb 2004
    New Zealand
    Provided Answers: 10
    What I have done is create a login screen the when the said screen is loaded have code loop thought all control and just hide/show them what I did was use the tag property and have admin or user in it it Admin login all controls showen if use only tag that had user tag would be showen.
    hope this help

    See clear as mud

    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008

  3. #3
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    or if you are using Workgroup seciurity
    better yet assign users to user groups
    then assign permissions to that for to user groups (or do a check in the form on load event) and set appropriate form permissions based on a usergroup security.

    Personally I prefer using the Network API call to get the users network logon.
    define appropriate usergroups with clear roles for the appliciation (eg View, Add, change, delete,admin)
    define the network logon inside the workgroup file and assign the user to as many groups as required
    then in each form / report request if that user is permitted to do the proposed action, OR set the forms status (to read only, edit or whatever).
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    May 2012
    I have worked with tags before in another db i made. I will do that.

    You can use statistics to prove anything - 78% of people know that!

Posting Permissions

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