Results 1 to 5 of 5
  1. #1
    resego is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Location
    Botswana
    Posts
    5

    Reseting user password

    Hi all

    I have been struggling since morning to run a vb code that enables users to change their password. I have a sample table and one form to test the functionality but nothing is happening.



    table name:tbluser_details
    fields
    User_password;text
    intUserID;numeric

    the code is as follows

    Private Sub Command13_Click()
    Dim intUserID As Integer
    Dim strOldPassword As String
    Dim strSQL As String
    intUserID = Me.List0

    strOldPassword = DLookup("[User_password]", "tbluser_details", "[User_id]=" & intUserID.Value)
    Select Case strOldPassword
    Case Is = Me.txtOldPassword
    Me.txtNewPass.SetFocus
    strSQL = "UPDATE tbluser_details SET User_password=" & "'" & Me.txtNewPass.Text & "'" & " " & "WHERE [User_id]=" & "'" & Me.Combo17 & "';"
    DoCmd.SetWarnings False
    DoCmd.RunSQL strSQL
    DoCmd.SetWarnings True
    MsgBox "Password has been changed", vbInformation, "Password Changed"

    Case Is <> Me.txtOldPassword
    MsgBox "The Old Password doesnot match", vbInformation, "Type Correct Old Password"
    Me.txtOldPassword = ""
    End Select


    please help urgently

  2. #2
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    probably because you are trying to update to the text value without inputting anything. If you temporarily disable your setwarnings, the error(s) will be reported

    try

    'Me.txtNewPass.SetFocus not required
    strSQL = "UPDATE tbluser_details SET User_password='" & Me.txtNewPass & "' WHERE [User_id]='" & Me.Combo17 & "'"


    However if user_id is a number then you need to change the where clause as well

    'Me.txtNewPass.SetFocus not required
    strSQL = "UPDATE tbluser_details SET User_password='" & Me.txtNewPass & "' WHERE [User_id]=" & Me.Combo17

  3. #3
    resego is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Location
    Botswana
    Posts
    5
    Hi Ajax

    I have tried to replace the line you highlighted above but still no update is made on my table when I click button. Where can I send u a copy of the DB to have a look at it? I guess you can advice better after seeing the sample DB. I have tried to attach it to the post but it is bigger than the forum quota

    please link me up on Skype username: resego5 so that I attach it there

    Thank you

  4. #4
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    sorry don't use Skype. suggest

    1.compact the db then
    2. zip it and post zipped file

  5. #5
    resego is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Location
    Botswana
    Posts
    5
    Thanks a lot Ajax
    I replaced my update statement with the one that you provided:

    strSQL = "UPDATE tbluser_details SET User_password='" & Me.txtNewPass & "' WHERE [User_id]=" & Me.Combo17

    the reason why it was not behaving accordingly was because I dd not enable the content when I launched the access.

    Thanks a lot for the help

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Login script needs to update user password
    By Jllera in forum Programming
    Replies: 7
    Last Post: 02-09-2015, 10:58 AM
  2. Multi-user Password in Microsoft Access 2007
    By JunJin,Pooi in forum SQL Server
    Replies: 2
    Last Post: 08-21-2013, 10:06 PM
  3. Replies: 2
    Last Post: 01-26-2013, 11:38 PM
  4. User to upadate Password Form
    By libraccess in forum Forms
    Replies: 2
    Last Post: 11-29-2012, 10:41 PM
  5. Problem with User Login and Password
    By sk88 in forum Access
    Replies: 3
    Last Post: 12-16-2011, 08:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums