By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,830 Members | 682 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,830 IT Pros & Developers. It's quick & easy.

Update Recordset in MS Access

pbala
P: 37
Hello,
I have problem in reset the new password with old one.For that I used the code as
Expand|Select|Wrap|Line Numbers
  1. Set rstreset = New ADODB.Recordset
  2. strtable = "Update USERS SET rstreset!Password = '" & upwd & "' where UserName='" & uname & "'"
Now I want to update it.How to update this?
Feb 18 '09 #1
Share this Question
Share on Google+
3 Replies


NeoPa
Expert Mod 15k+
P: 31,418
Very confusing question.

You say you've used this code, yet this isn't workable code. It cannot work.

Without this to give a clue there is no sense in the question.
Feb 18 '09 #2

NeoPa
Expert Mod 15k+
P: 31,418
It seems this could work as :
Expand|Select|Wrap|Line Numbers
  1. strTable = "Update USERS SET [Password]='" & upwd & "' WHERE [UserName]='" & uname & "'"
But I still don't understand what your question is. What do you want help with?
Feb 18 '09 #3

ADezii
Expert 5K+
P: 8,623
@pbala
I'll assume you have a Table named USERS and you wish to Update the Password of a User named uname to upwd. Should that be the case, you can use the following code as a Basic Template:
Expand|Select|Wrap|Line Numbers
  1. Dim strSQL As String
  2. Dim upwd As String
  3. Dim uname As String
  4.  
  5. upwd = "New Password"
  6. uname = "ADezii"
  7.  
  8. 'Does the User even exist?
  9. If DCount("*", "USERS", "[UserName] = '" & uname & "'") = 0 Then
  10.   MsgBox "The User " & uname & " is not a valid User Name!", vbExclamation, "No User"
  11.     Exit Sub
  12. End If
  13.  
  14. strSQL = "Update USERS SET USERS.[Password] = '" & upwd & _
  15.          "' Where USERS.[UserName] ='" & uname & "'"
  16.  
  17. CurrentDb.Execute strSQL, dbFailOnError
Feb 18 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.