Clear password from form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • danibecr
    New Member
    • Oct 2006
    • 18

    Clear password from form

    I'v got a form thats going to delete a bunch of stuff but I want it pw protected so I created a in-between form asking for a pw. But I cant get the PW to be blank when I open the form. I have a table with PW and PW Entered where PW is the correct and PW Entered is the users pw. If it's correct then it goes ahead and opens the correct form but if it's incorrect it closes just like it's supposed to. But after all is said and done the next time I open the in-between form the PW is still there whether correct or incorrect. I just need it to be gone everytime. any suggestions are great..... thanks.




    Private Sub Command5_Click( )
    If Me.Entered_Pass word = Me.Password Then
    DoCmd.OpenForm "ResetDaysWork" , acNormal, , , acFormEdit, acWindowNormal
    DoCmd.Close acForm, "OpenReset" , acSaveNo
    Else
    DoCmd.Close acForm, "OpenReset" , acSaveNo

    End If
    End Sub.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Normally you don't bind the table to the password form.
    Usually it's unbound and you merely check the password against the value in the table.

    Comment

    • danibecr
      New Member
      • Oct 2006
      • 18

      #3
      Can you please explain in a little more detail? I'm a self taughter...

      What if my table contained ONLY the PW and the field on the form was a text box...

      Private Sub Command5_Click( )
      If Me.Password = [Tables]![ResetPW]![Password] Then
      DoCmd.OpenForm "ResetDaysWork" , acNormal, , , acFormEdit, acWindowNormal
      DoCmd.Close acForm, "OpenReset" , acSaveNo
      'DoCmd.OpenQuer y "ClearEnteredPW ", acViewNormal, acReadOnly
      Else
      DoCmd.Close acForm, "OpenReset" , acSaveNo

      End If
      End Sub

      But I don't think the [Tables]![ResetPW]![Password] is right.. it's saying It cant find the field 'Tables'

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        You can't refer to the values in a table using Tables!TableNam e!FieldName
        You have to use DLookup("FieldN ame", "TableName" , "Optional Where Clause")

        Comment

        • danibecr
          New Member
          • Oct 2006
          • 18

          #5
          Thanks a million.... I got it going now.... Ya'll are the best..

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            Not a problem, good luck.

            Comment

            Working...