Dear Experts,
I am stuck with pretty good error, which I understand but unable to cope up with.
What I am expecting is : I have a form to provide OTP to 1st time users. The user have to select the Employee Name from the "Combo Box" which is fetched from the Table "AddUser". Now All the validation for checking is perfectly fine. But the twist is; I want that the value entered in the password textbox should be inserted in the table "AddUser" by comparing the Employee Id in it.
Note: Initially the value in password field is null.
The Details are as below:
Table 1:- AddUser(Id{Auto no},EmployeeId, Password,SOEID. ..etc)
Table 2:- tblUserquery(Em ployeeId,Passwo rd,SOEID)
There is a form 'GetPassword'
Code:
Now the I have tried lots of queries and ways to get it work, but it is not helping out.
I will be glad to hear answer from you.
Thanks in advance.
Looking forward for your replies.
I am stuck with pretty good error, which I understand but unable to cope up with.
What I am expecting is : I have a form to provide OTP to 1st time users. The user have to select the Employee Name from the "Combo Box" which is fetched from the Table "AddUser". Now All the validation for checking is perfectly fine. But the twist is; I want that the value entered in the password textbox should be inserted in the table "AddUser" by comparing the Employee Id in it.
Note: Initially the value in password field is null.
The Details are as below:
Table 1:- AddUser(Id{Auto no},EmployeeId, Password,SOEID. ..etc)
Table 2:- tblUserquery(Em ployeeId,Passwo rd,SOEID)
There is a form 'GetPassword'
Code:
Code:
Option Compare Database
Private Sub CboUser_AfterUpdate()
Me.txtLogInPassword = DLookup("Password", "tblUserqry", "[EmployeeId]=" & Me![CboUser])
Me.UserName = DLookup("EmployeeId", "tblUserqry", "[EmployeeId]=" & Me![CboUser])
Me.txtSoeid = DLookup("SOEID", "tblUserqry", "[EmployeeId]=" & Me![CboUser])
If IsNull(Me.txtLogInPassword) And Me.txtSoeid = txtUserSoeid Then
Me.txtNewPassword.Enabled = True
Me.txtConfirmnewpassword.Enabled = True
Else
MsgBox "Applicable only for New Users"
Me.txtNewPassword.Enabled = False
Me.txtConfirmnewpassword.Enabled = False
End If
End Sub
Code:
Private Sub Form_Open(Cancel As Integer)
Me.txtNewPassword.Enabled = False
Me.txtConfirmnewpassword.Enabled = False
End Sub
Code:
Private Sub submit_Click()
Dim Pwd As String
'Dim User As String
If Me.txtNewPassword = Me.txtConfirmnewpassword Then
'DoCmd.RunCommand acCmdSaveRecord
Pwd = Me.txtConfirmnewpassword
'User = Me![CboUser] 'Assigning value of current user to the var
MsgBox "Congrats! Password Changed Successfully"
'DoCmd.close acForm, "GetPassword", acSaveYes
CurrentDb.Execute "INSERT INTO tblUserqry ([Password]) VALUES ('" & Pwd & "') WHERE tblUserqry.EmployeeId='" & User & "';", dbFailOnError
'CurrentDb.Execute "UPDATE tblUserqry SET Password='& Pwd &' WHERE tblUserqry.EmployeeId='" & User & "';", dbFailOnError
'CurrentDb.Execute "UPDATE tblUserqry where SET Password='& Pwd &' WHERE tblUserqry.EmployeeId= & Me![CboUser] ;", dbFailOnError
Else
MsgBox " Your Password doesnot match, try again!", 48, " Password Error "
Me!txtNewPassword = ""
Me!txtConfirmnewpassword = ""
Me!txtNewPassword.SetFocus
End If
End Sub
Now the I have tried lots of queries and ways to get it work, but it is not helping out.
I will be glad to hear answer from you.
Thanks in advance.
Looking forward for your replies.
Comment