Hi, I would like to check to see if when a user changes his password, that the password does not currently exist in the password table. This is what I have so far:
Dim strPassword As String
Dim rst As DAO.Recordset
Dim fld As DAO.Field
Set rst = CurrentDb.OpenRecordset("SELECT tblSecurity.PassWd FROM tblSecurity", dbOpenDynaset)
Set fld = rst("[PassWd]"
rst.MoveFirst
If Me.txtNewPass = DLookup("[passwd]", "tblSecurity", "[passwd]"
Then
MsgBox "This Password is Unavailable. Please Select Another Password"
End If
Do Until rst.EOF
strPassword = fld
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
I don't get any errors or Message Boxes either so something is wrong. I was thinking that this would lookup the first record and compare it to Me.txtNewPass. If it did not equal Me.txtNewPass then it would go on to the next record and so on.
I'm not sure this is the correct way to do this. Any help would be appreciated.
Thanks
Dim strPassword As String
Dim rst As DAO.Recordset
Dim fld As DAO.Field
Set rst = CurrentDb.OpenRecordset("SELECT tblSecurity.PassWd FROM tblSecurity", dbOpenDynaset)
Set fld = rst("[PassWd]"
rst.MoveFirst
If Me.txtNewPass = DLookup("[passwd]", "tblSecurity", "[passwd]"
MsgBox "This Password is Unavailable. Please Select Another Password"
End If
Do Until rst.EOF
strPassword = fld
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
I don't get any errors or Message Boxes either so something is wrong. I was thinking that this would lookup the first record and compare it to Me.txtNewPass. If it did not equal Me.txtNewPass then it would go on to the next record and so on.
I'm not sure this is the correct way to do this. Any help would be appreciated.
Thanks