cixelsyd cixelsyd - 6 months ago 39
SQL Question

Access Login Password Update VBA & SQL

Have an Access front end Login Form which includes an option for the user to change password. In frm_Login Sub I'm attempting to use the following to pass the entered username "Me.txtUserName" to 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:

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.
Can anyone help?


You need one more comma before your Me.txtUserName

Right now you're trying to pass it to the WindowMode argument

Just use Intellisense as you type and insert your commas - it'll popup the argument as you go along