I have no idea what happened, but my change password form just stopped working. The code below is used on the cmdChange_password button. It get an error in the second line everything I try to change the password saying
"Compiler error, user-defined type not defined."
It worked when I just wrote the code, but not it's not working, lol. Can anyone help, I mean do anyone know why?
Here's the code
Private Sub ChangePass_Click()
Dim ThisDB As DAO.Database ---------> error in this line here.
Dim rstPassword As DAO.Recordset
If IsNull(Me.CurrentPass.Value) Then
MsgBox "You must enter the current password before changing.", vbExclamation, "Password Not Changed."
ElseIf IsNull(Me.NewPass.Value) Then
MsgBox "You must enter a password before saving changes.", vbExclamation, "Password Not Changed."
ElseIf Me.CurrentPass.Value <> DLookup("Password", "tblPassword") Then
MsgBox "The current password you have entered is incorrect.", vbExclamation, "Password Not Changed."
ElseIf Me.NewPass.Value <> Me.CurrentPasscheck.Value Then
MsgBox "The passwords you have entered do not match!", vbExclamation, "Password Not Changed."
Else
Set ThisDB = CurrentDb()
Set rstPassword = ThisDB.OpenRecordset("tblPassword", dbOpenDynaset)
ThisDB.Execute "DELETE * FROM tblPassword;", dbFailOnError 'Clear table to ensure only one password
With rstPassword
.AddNew
!Password = Me.NewPass.Value
.Update
End With
rstPassword.Close
ThisDB.Close
Set rstPassword = Nothing
Set ThisDB = Nothing
MsgBox "Your Password have been changed"
DoCmd.Close
End If
End Sub
Chaosguy - To die would be an awefully big adventure.
"Compiler error, user-defined type not defined."
It worked when I just wrote the code, but not it's not working, lol. Can anyone help, I mean do anyone know why?
Here's the code
Private Sub ChangePass_Click()
Dim ThisDB As DAO.Database ---------> error in this line here.
Dim rstPassword As DAO.Recordset
If IsNull(Me.CurrentPass.Value) Then
MsgBox "You must enter the current password before changing.", vbExclamation, "Password Not Changed."
ElseIf IsNull(Me.NewPass.Value) Then
MsgBox "You must enter a password before saving changes.", vbExclamation, "Password Not Changed."
ElseIf Me.CurrentPass.Value <> DLookup("Password", "tblPassword") Then
MsgBox "The current password you have entered is incorrect.", vbExclamation, "Password Not Changed."
ElseIf Me.NewPass.Value <> Me.CurrentPasscheck.Value Then
MsgBox "The passwords you have entered do not match!", vbExclamation, "Password Not Changed."
Else
Set ThisDB = CurrentDb()
Set rstPassword = ThisDB.OpenRecordset("tblPassword", dbOpenDynaset)
ThisDB.Execute "DELETE * FROM tblPassword;", dbFailOnError 'Clear table to ensure only one password
With rstPassword
.AddNew
!Password = Me.NewPass.Value
.Update
End With
rstPassword.Close
ThisDB.Close
Set rstPassword = Nothing
Set ThisDB = Nothing
MsgBox "Your Password have been changed"
DoCmd.Close
End If
End Sub
Chaosguy - To die would be an awefully big adventure.