Results 1 to 4 of 4
  1. #1
    PKJ is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2010
    Location
    Jaipur, India
    Posts
    6

    Please help on this UPDATE Query.

    I have two tables Lt_Offices and Lt_Designation both having a field named RankLevel. I want to update Lt_Offices.RankLevel from the values of Lt_Designations.RankLevel. I have tried following two variants of the UPDATE query but Access pops the message - "Operation must be an updateable query."

    These queries are not working -
    1.
    UPDATE Lt_Offices
    SET Lt_Offices.RankLevel = (SELECT Lt_Designations.RankLevel
    FROM Lt_Offices LEFT JOIN Lt_Designations
    ON Lt_Offices.DesigCodeOfHolder = Lt_Designations.DesigRank
    WHERE Lt_Designations.DesigRank = Lt_Offices.DesigCodeOfHolder);


    2.
    UPDATE Lt_Offices SET Lt_Offices.RankLevel = (Select Lt_Designations.RankLevel FROM Lt_Designations WHERE Lt_Designations.DesigRank = Lt_Offices.DesigCodeOfHolder)
    WHERE EXISTS (Select Lt_Designations.RankLevel FROM Lt_Designations WHERE Lt_Designations.DesigRank = Lt_Offices.DesigCodeOfHolder);

    I would appreciate any help on these queries - both are for same purpose but none is working.
    Thanks.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    How are your tables related? What are the Primary and Foreign keys?

    This may work
    UPDATE Lt_Offices INNER JOIN Lt_Designations ON
    Lt_Offices.DesigCodeOfHolder = Lt_Designations.DesigRank
    SET Lt_Offices.RankLevel = Lt_Designations.RankLevel
    provided that the tables are joined
    ON Lt_Offices.DesigCodeOfHolder = Lt_Designations.DesigRank

  3. #3
    PKJ is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2010
    Location
    Jaipur, India
    Posts
    6
    Thanks it works now.

  4. #4
    PKJ is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2010
    Location
    Jaipur, India
    Posts
    6
    I had not joined the tables - after doing the join as suggested by Orange i.e. ON Lt_Offices.DesigCodeOfHolder = Lt_Designations.DesigRank, the query runs fine. Many thanks to him.T

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

Similar Threads

  1. Replies: 4
    Last Post: 11-10-2011, 03:41 PM
  2. Replies: 2
    Last Post: 09-21-2011, 01:30 PM
  3. Replies: 1
    Last Post: 08-19-2011, 12:16 PM
  4. Update 2 tables with one Update Query
    By Douglasrac in forum Queries
    Replies: 4
    Last Post: 04-14-2011, 08:33 AM
  5. Update Query- selective update?
    By stephenaa5 in forum Queries
    Replies: 1
    Last Post: 10-29-2009, 11:15 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