469,125 Members | 1,676 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,125 developers. It's quick & easy.

Update Recordset in MS Access

pbala
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
3 3461
NeoPa
32,161 Expert Mod 16PB
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
32,161 Expert Mod 16PB
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
8,800 Expert 8TB
@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.

Similar topics

reply views Thread by Sue Adams | last post: by
1 post views Thread by Just_Buy | last post: by
2 posts views Thread by Joseph Markovich | last post: by
6 posts views Thread by Matt | last post: by
2 posts views Thread by DaveN | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.