access vba - Reset password subform -
i come today ask advise coding in still have issues. working @ beginning in normal form, decided adapt real situation base analytics on subform elements.
would mind taking @ , tell wrong ?
thanks lot help:
public function resetpassword() 'on error goto macro1_err dim frm form set frm = screen.activeform if dlookup("[user login]![password]", "[user login]", "[user login]![username]= [textlogin]") = frm.forms.navigationsubform.textpass.value if frm.forms.navigationsubform.textnewpass.value = frm.forms.navigationsubform.textnewpassconfirmation.value strsql = "update [user login]" _ & "set [user login].[password] =" & frm.forms.navigationsubform.[textnewpass].value _ & "where ((([user login].[username])=" & frm.forms.navigationsubform.[textlogin].value & "));" docmd.runsql strsql beep msgbox "your password has been effective. thanks!", vbokonly, "success" exit function else beep msgbox "you must confirm new password.", vbokonly, "" end if else beep msgbox "you might have enter invalid password, please retry.", vbokonly, "" end if 'macro1_exit: 'exit function 'macro1_err: 'msgbox error$ 'resume macro1_exit end function
i getting 2465 error : 'application defined or object defined error"
best regards,
i found out answer. posting here in case others meetings same issue.
my code not working because did not take account fact in subform.
final working code:
'------------------------------------------------------------ ' reset password ' '------------------------------------------------------------ public function resetpassword() 'on error goto macro1_err dim frm form set frm = screen.activeform if dlookup("[password]", "[user login]", "[username]='" & frm.navigationsubform.form![textlogin].value & "'") = frm.navigationsubform.form!textpass.value if frm.navigationsubform.form!textnewpass.value = frm.navigationsubform.form!textnewpassconfirmation.value strsql = "update [user login]" _ & "set [user login].[password] ='" & frm.navigationsubform.form![textnewpass] _ & "' ((([user login].[username])='" & frm.navigationsubform.form![textlogin] & "'));" docmd.runsql strsql beep msgbox "your password has been effective. thanks!", vbokonly, "success" exit function else beep msgbox "you must confirm new password.", vbokonly, "" end if else beep msgbox "you might have enter invalid password, please retry.", vbokonly, "" end if 'macro1_exit: 'exit function 'macro1_err: 'msgbox error$ 'resume macro1_exit end function
regards,
Comments
Post a Comment