Saving Password

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Proggy
    New Member
    • Oct 2014
    • 13

    Saving Password

    im a beginner in programming, and im currently working on my first project which is the book borrowing system.
    my only problem is that everytime i try to change the password of my system.. when i hit the cancel button the previous password disappears and u i can easily enter in the system without inputting password.where do u think is the problem?
    thanks.



    Code:
    Private Sub cmdCancel_Click()
    If MsgBox("are you sure you want to cancel?", vbQuestion + vbYesNo, "Cancel") = vbYes Then
    Data1.Recordset.CancelUpdate
        normalButton
        Call txtinactive
    
        cmdEdit.Enabled = True
        cmdSave.Enabled = False
        cmdCancel.Enabled = False
    Else
        End If
    End Sub
    
    Private Sub cmdEdit_Click()
    If txtuname = "Administrator" Then
    MsgBox "Only Password can edit", vbInformation, "Borrower's List System"
        txtuname.Visible = False
    End If
    Data1.Recordset.Edit
    
    lblnew.Visible = True
    lblpass.Visible = False
    lbluser.Visible = False
    txtuname.Visible = False
    lblAdmin.Visible = True
    
    
    Call add_record
    txtpass = ""
    txtretype = ""
    txthint = ""
    End Sub
    
    Sub add_record()
    txtuname.Enabled = False
    txtpass.Enabled = True
    txtretype.Enabled = True
    
    cmdSave.Enabled = True
    cmdCancel.Enabled = True
    End Sub
    Private Sub txtinactive()
    txtpass.Enabled = False
    txtretype.Enabled = False
    End Sub
    Private Sub normalButton()
    cmdEdit.Enabled = True
    cmdSave.Enabled = False
    cmdCancel.Enabled = False
    End Sub
    Private Sub cmdMain_Click()
    Unload Me
    frmMenu.Show
    End Sub
    
    Private Sub cmdSave_Click()
    If txtretype = "" Or txtpass = "" Or txthint = "" Then
    MsgBox "Incomplete Information!", vbError + vbOKOnly, "Admin account"
    ElseIf txtretype = "" Then
    MsgBox "re-type password first", vbInformation + vbOKOnly, "Admin account"
    ElseIf txtpass = txthint Then
    MsgBox "You password and passwordhint must not be the same", vbInformation + vbOKOnly, "Password"
    txthint = ""
    ElseIf txtpass = txtretype Then
        If MsgBox("Are you sure you want to save changes?", vbQuestion + vbYesNo, "Save Changes") = vbYes Then
            
            Data1.Recordset.Edit
            Data1.Recordset.Fields("Confirm").value = txtretype.Text
            Data1.Recordset.Fields("Password").value = txtpass.Text
            Data1.Recordset.Fields("Hint").value = txthint.Text
            Data1.Recordset.Update
            
            MsgBox "Account has been Successfully Updated.Program will restart to update your new password.", vbDefaultButton3 + vbMsgBoxSetForeground, " Account"
            cmdEdit.Enabled = True
            frmLogin.Show
            Unload Me
            
            
            Call normalButton
            Call txtinactive
        
            cmdEdit.Enabled = True
            cmdSave.Enabled = False
            cmdCancel.Enabled = False
        End If
    Else
    MsgBox "password not match", vbInformation + vbOKOnly, "admin account"
    End If
    End Sub
    
    Private Sub Form_Load()
    lblAdmin.Visible = False
    lblnew.Visible = False
    
    Data1.Visible = False
    
    End Sub
    Attached Files
  • twinnyfo
    Recognized Expert Moderator Specialist
    • Nov 2011
    • 3662

    #2
    Proggy,

    It is difficult to follow your code to determine exactly what you are trying to do in it.

    First, you give us no indicate what Data1 is or where it comes from. You also use a very unorthodox way of updating your data. It is not "wrong", just unorthodox and not very typical.

    It does not appear that your form is simply built around a table with bound controls, but it is not clear from either your code or from your picture.

    If anything, when changing passwords, you should verify all the information concerning the passwords before you save it to your table. That way if anyone cancels the action, there have not been any changes made.

    Not sure if this helps much, but if you can describe in a little better detail how you want your project to work, we'll be glad to take a look into it.

    Comment

    • Proggy
      New Member
      • Oct 2014
      • 13

      #3
      this problem particularly refers to managing accounts of the administrator.b ut since this project can only be used by admin only password can be changed.
      do u want to look on my project?

      Comment

      • Proggy
        New Member
        • Oct 2014
        • 13

        #4
        Saving Password

        HI this is the project i made.
        im not really a good programmer.
        and im trying to improve my knowledge.
        i hope u understand.
        :)
        Attached Files

        Comment

        • twinnyfo
          Recognized Expert Moderator Specialist
          • Nov 2011
          • 3662

          #5
          Proggy,

          We typically don't have Posters send in their projects, as usually threads deal with specific questions regarding one particular aspect of the project, rather than the project itself.

          However, regarding your particular question, please let us know how your form is related to your table(s). At this point, we don't even know what your table(s) look like, and the structure will dictate how to solve your problem.

          We are willing to assist, but we need more information.

          If you want, you can take a look at this article (How To Create User Permissions and Customized Menus in MS Access), which appears to be more involved than what you may want at this point, but would also point you in the right direction for user permissions.

          Let us know how we can further assist.

          Comment

          Working...