donkey9972
Registered User.
- Local time
- Today, 13:33
- Joined
- May 18, 2008
- Messages
- 42
Ok, I have a password change form. On that form it has a combo box and the password and confirm password fields. I want to stop using the combo box and change it to just a regular unbound field. So, I did this and now I am having errors when it tried to run.
When I use the combo box I have this code
listed for the combo box. And this code
for the actual save button. Now when I change the combo box to a text box and input the username it gives me this error:
Run-time error '3061': Too few parameters. Expected 1.
on this line of code
Then if I just stop the debug and continue with the input to change the password I get this error:
Run-time error '3075': Syntax error (missing operator) in query expression 'userID ='.
on this line of code
I am a stuck on this problem right now. I hope there is help out there.
When I use the combo box I have this code
Code:
Private Sub cmbName_AfterUpdate()
Dim rst As Recordset
Dim dbs As Database
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("SELECT *FROM tlogin WHERE userID =" & Me.cmbName)
Me.txtID = rst!userID
End Sub
Code:
Private Sub btnSave_Click()
DoCmd.SetWarnings False
If Not Me.txtConfirmPassword = Me.txtPassword Then
MsgBox "Please check your password!", vbInformation, "SDS info"
Exit Sub
Else
DoCmd.RunSQL ("Update tlogin SET password = """ & Me.txtPassword & """ WHERE userID = " & Me.txtID)
MsgBox "Password renewed", vbInformation, "SDS info"
DoCmd.Close
DoCmd.OpenForm "flogin"
End If
End Sub
for the actual save button. Now when I change the combo box to a text box and input the username it gives me this error:
Run-time error '3061': Too few parameters. Expected 1.
on this line of code
Code:
Set rst = dbs.OpenRecordset("SELECT *FROM tlogin WHERE userID =" & Me.userName)
Then if I just stop the debug and continue with the input to change the password I get this error:
Run-time error '3075': Syntax error (missing operator) in query expression 'userID ='.
on this line of code
Code:
DoCmd.RunSQL ("Update tlogin SET password = """ & Me.txtPassword & """ WHERE userID = " & Me.txtID)
I am a stuck on this problem right now. I hope there is help out there.