Results 1 to 4 of 4
  1. #1
    blue4512 is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    26

    Red face Update Field

    I am sure this question has been asked a million times - but I can't find the answer I need.


    I need to update a a field in a record once a field in a a different record is updated.
    I have used Macros to accomplish this but the process is taking too long, it updates the entire table. I don't see anywhere I could set a where to only reference the one record.

    Any help would be greatly appreciated.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    The WHERE would be set in the SQL UPDATE action statement. I don't use macros, only VBA, like:

    CurrentDb.Execute "UPDATE tablename SET fieldname=" & <input value1> & " WHERE ID=" & <input value2>

    The input values could be references to controls on form.

    Why do you need this update? Is data being duplicated between tables?
    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.

  3. #3
    blue4512 is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    26
    Once a service that is linked to an estimate is authorized I want the estimate to change status to authorized, I don't think this is duplicating information. Can I add the WHERE statement in VB and still utilize the macro? I do not use VBA and am somewhat intimidated, although I should learn!

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Is the status field a Yes/No type? You want to update only one record? What are names of the linking pk/fk fields of these two tables?

    Not sure what you mean by 'add the WHERE statement in VBA and still utilize the macro'. As far as I know, macros can call VBA user function procedures but not sub procedures.

    Should be able to build an Access UPDATE query object with the appropriate syntax and parameters and run the query from macro.
    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. Replies: 12
    Last Post: 03-17-2012, 04:46 AM
  2. Replies: 1
    Last Post: 08-31-2011, 04:03 PM
  3. Update field in subform from field in Main
    By jpkeller55 in forum Access
    Replies: 9
    Last Post: 10-15-2010, 03:37 PM
  4. Update field in table after update on a subform
    By jpkeller55 in forum Queries
    Replies: 3
    Last Post: 09-30-2010, 08:02 PM
  5. Replies: 2
    Last Post: 05-05-2010, 02:52 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