简体   繁体   English

访问登录密码更新 VBA 和 SQL

[英]Access Login Password Update VBA & SQL

Have an Access front end Login Form which includes an option for the user to change password.拥有一个 Access 前端登录表单,其中包含一个供用户更改密码的选项。 In frm_Login Sub I'm attempting to use the following to pass the entered username "Me.txtUserName" to frm_PassChange:在 frm_Login Sub 中,我尝试使用以下内容将输入的用户名“Me.txtUserName”传递给 frm_PassChange:

If Me.changepass = "Yes" Then
    DoCmd.OpenForm "frm_PassChange", , , , , Me.txtUserName
End If

In frm_PassChange Sub I want the user to enter a new password "Me.txtNewPass" which I will then store in a usertable X_tblUsers:在 frm_PassChange Sub 中,我希望用户输入一个新密码“Me.txtNewPass”,然后将其存储在用户表 X_tblUsers 中:

CurrentDb.Execute "UPDATE X_tblUsers SET X_tblUsers.Password = '" & Replace(Me.txtNewPass.Value, "'", "''") & "' " & _
                    "WHERE X_tblUsers.Username = '" & Me.OpenArgs & "'"

I'm getting a type mismatch error on the DoCmd.OpenForm call.我在 DoCmd.OpenForm 调用中遇到类型不匹配错误。 Can anyone help?任何人都可以帮忙吗?

You need one more comma before your Me.txtUserName你的Me.txtUserName前还需要一个逗号

Right now you're trying to pass it to the WindowMode argument现在你正试图将它传递给 WindowMode 参数

Just use Intellisense as you type and insert your commas - it'll popup the argument as you go along只需在您键入并插入逗号时使用 Intellisense - 它会在您进行时弹出参数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM