Results 1 to 2 of 2
  1. #1
    behnam is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    72

    How to find a record with a certain field and update that record?

    Hi All,

    I have a combo box called cbo1. What i like to do is when a button is clicked, the code will search for a record in a table called login (column called username and it finds the username that is the same as the value in the combo box), and change one of the fields in the table which is called password with the value the user enters in a textbox called textbox12. Can someone please help me with the vba code.



    Thanks for you time and consideration.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Method depends on the form set up. Is form bound to Login table? If it is, options are:

    1. code can use the input to find record and edit the field

    2. code would execute UPDATE sql action and then refresh the form

    If the form is not bound to table then code would execute UPDATE sql action but form refresh would not be required.

    CurrentDb.Execute "UPDATE tablename Set password='" & Me.textbox12 & "' WHERE username='" & Me.cbo1 & "'"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Update attachment field in existing record
    By incipientclarity in forum Programming
    Replies: 5
    Last Post: 05-28-2014, 07:20 AM
  2. Replies: 4
    Last Post: 04-01-2014, 02:33 PM
  3. Replies: 4
    Last Post: 12-14-2012, 06:33 PM
  4. Replies: 12
    Last Post: 03-14-2012, 10:54 AM
  5. Replies: 4
    Last Post: 07-22-2009, 02:33 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