Results 1 to 15 of 15
  1. #1
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239

    Exclamation error 3464 - Password change form

    hi, in addition to having a combo box and txtPassword, I have modified my login form to include two more text boxes (txtnewPW and txtConfPW). These are initially invisible but when the user's PWreset field (in the user table) is true, they become visible. When I click on the OK button, I want the new password to update user's password in the table tblUser.

    on the highlighted line, I'm getting run-time error 3464: "data type mismatch in criteria expression". what is wrong with this code?


    Dim strSQL As String
    Dim db As DAO.Database

    Set db = CurrentDb

    strSQL = "UPDATE tblUser SET tblUser.strPassword = '" & Me.txtConfPW.Value & "' " & "WHERE (((tblUser.UserID)='" & Forms!frmLogin!cmbUser.Column(0) & "'));"

    If Not IsNull(Me.txtPassword) And Me.txtConfPW <> Me.txtPassword Then
    db.Execute strSQL, dbFailOnError

    DLookup("strPassword", "tblUser", "[UserID]=" & Forms!frmLogin!cmbUser.Column(0)) = Me.txtConfPW.value
    MsgBox "Password updated!", vbOKOnly, "Success!"
    'MsgBox "You must log in again with new password"

    Else
    MsgBox "Password confirmation does not match New Password.", vbOKOnly, "Mismatched Password Confirmation"
    Me.txtNewPW.Visible = True


    Me.txtConfPW.Visible = True
    Me.txtConfPW.SetFocus
    End If

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    In the table, is tblUser.strPassword a Text type field?
    In the table, is tblUser.UserID a Text type field?

    For debugging, add the blue lines to your code.:
    Code:
    msgbox Me.txtConfPW
    msgbox Forms!frmLogin!cmbUser.Column(0)
    
    strSql = "UPDATE.........."
    debug.print strSql
    Is the displayed data what you expect given the fields data types?

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    dont run that...just use
    docmd.runsql strSQL

  4. #4
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    many thanks steve.

    huh? don't run what

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Using
    db.Execute strSQL, dbFailOnError
    is handled by Jet (faster)

    Using
    docmd.runsql strSQL (slower)
    has to be interperated first by Access, then executed by Jet. DoCmd also gives the warning messages; dB.Execute (or Currentdb.Execute) doesn't.

    I always use "db.Execute strSQL, dbFailOnError", never "docmd.runsql".

  6. #6
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    Okay ranman, I assumed that I understood your post but commenting' out the currentdb.execute line still causes the error.

    Steve - on tblUser, strPassword is Text data type and userID is autonumber. I added the lines. It gave me back my new password and userID and at then end, the error 3464 on the same line

  7. #7
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    and userID is autonumber.
    Then the WHERE clause should not have the single quotes:
    Code:
    "WHERE (((tblUser.UserID)='" & Forms!frmLogin!cmbUser.Column(0) & "'));"
    Should be:
    Code:
    "WHERE (((tblUser.UserID)=" & Forms!frmLogin!cmbUser.Column(0) & " ));"
    It is better to use "db.Execute " (IMHO)

  8. #8
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    thanks Steve. Sorry, it's been a long day and I'm kinda in a daze right now, what does IMHO means

  9. #9
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664

  10. #10
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    thanks for that Steve. Nothing like humour to lighten the day. I'll study that dictionary closely.

    My code now works by the way. Thank you and thanks to you as well ranman. Have an excellent weekend!!

  11. #11
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239

    Exclamation error 3464 - Password change form

    um... question though. I want the PWreset field to be set to False after the password update.
    I used the code in blue but it is not working... it is giving run time error 451 on the same line

    sigh! I should have just left for the day. I had to go and add something to the program

    MsgBox "Password updated!", vbOKOnly, "Success!"
    MsgBox "You must log in again with new password"
    Forms!frmLogin!cmbUser.Column(4) = False

  12. #12
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You can't change the value of a column in the row source for the combo box. You have to update the underlying table for whatever the field is in Column(4), then requery the combo box (or maybe the form - I've never tried this). Does that make sense?

    Something like"
    Code:
    strSQL = "UPDATE tblUser SET tblUser.PWreset = FALSE WHERE tblUser.UserID =" & Forms!frmLogin!cmbUser.Column(0) & ";"
    db.Execute strSQL, dbFailOnError
    Not sure what the table name is.....

  13. #13
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    hey Steve, yes it makes sense to me. I'll try that and repost an update
    thanks again

  14. #14
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    yes, yes yes yes, it worked Steve to the rescue again.
    thanks

  15. #15
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Aww, shucks.....

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

Similar Threads

  1. Execution error 3464
    By Trisha in forum Access
    Replies: 3
    Last Post: 03-03-2014, 01:03 PM
  2. Error in Change Password Form
    By Manan Hotak in forum Forms
    Replies: 6
    Last Post: 08-28-2012, 07:31 AM
  3. Replies: 1
    Last Post: 06-22-2012, 08:05 AM
  4. Error when I try to change password
    By accessnewb in forum Programming
    Replies: 9
    Last Post: 07-27-2011, 01:08 PM
  5. 3464 error received
    By TEN in forum Programming
    Replies: 10
    Last Post: 07-08-2009, 07:25 PM

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