Results 1 to 4 of 4
  1. #1
    Access_Blaster is offline User
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2010
    Posts
    339

    Update the current record.


    I use a query to find matching records, after the record is found I want to update the Boolean field for that record. I am trying to use the following code. As you can see it updates all records within that field. I need to specify the current record. Any help is appreciated.

    Code:
    CurrentDb.Execute ("UPDATE TBL_Vendor SET TBL_Vendor.Active = -1;"), dbFailOnError

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Along the lines of

    Code:
    CurrentDb.Execute "UPDATE TBL_Vendor SET TBL_Vendor.Active = -1 WHERE KeyFieldName = " & Me.KeyFieldName, dbFailOnError
    Using the actual field and control names.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Access_Blaster is offline User
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2010
    Posts
    339
    Thanks Paul, I neglected to mention I was dealing with a list box, after figuring out my ID was in column (0) it worked.. thank for pointing me in the right direction.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 16
    Last Post: 02-06-2013, 03:06 PM
  2. Replies: 13
    Last Post: 12-17-2012, 07:52 PM
  3. Replies: 3
    Last Post: 09-18-2011, 03:46 PM
  4. Current Record Update Issue
    By SALPBE in forum Programming
    Replies: 0
    Last Post: 02-23-2011, 03:02 PM
  5. Run Update Query on Current Record in Form
    By c3pse in forum Queries
    Replies: 3
    Last Post: 08-14-2010, 05:40 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