Results 1 to 5 of 5
  1. #1
    frustratedwithaccess is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Oct 2014
    Posts
    35

    Update Query returning more records than table it is updating

    Hello All,



    I am attempting to run an "UPDATE" query however it is returning more records than in the table I am trying to update. Any suggestions as to where I might start in solving this issue?

    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,726
    Before doing an Update, use a SELECT query that is ReadOnly and make sure you are selecting the proper records.

    Show us your query SQL.

  3. #3
    frustratedwithaccess is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Oct 2014
    Posts
    35
    Thanks for the response. I will try the SELECT query that is ReadOnly

    Re SQL

    UPDATE

    TABLE1

    AS

    TABLE1

    INNER JOIN

    TABLE2

    ON

    (Table1.SamDate = Table2.SamDate) AND

    (Table1.ProjectNumber = Table2.ProjectNumber)

    SET

    Table1.Flag1 = Table2.Flag1

    WHERE

    Table1.Flag1 IS NULL;


    The column named Flag1 in Table1 has many records that are null (empty cell) and other records that have data. I am attempting to update these empty records with data from Table2.

  4. #4
    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,726
    Try this query in your query grid SQL view.

    Code:
    SELECT "Flag1 " & NZ(t1.Flag,"NULL") &  "  Flag2  " & t2.Flag1 & "   " & t1.ProjectNumber & "  "  & t1.SamDate
    FROM Table1 as T1 inner join Table2 as T2 
    ON (T1.SamDate = T2.SamDate) AND
    (T1.ProjectNumber = T2.ProjectNumber)

  5. #5
    frustratedwithaccess is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Oct 2014
    Posts
    35
    Hi Orange.

    Thank you for your help, and please excuse my delayed response. I didn't end up having to try this query. I eventually found some issues with the tables I was using to populate my main table with.

    Again, thanks for the time. It is much appreciated.

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

Similar Threads

  1. Replies: 6
    Last Post: 05-04-2014, 12:53 PM
  2. Replies: 6
    Last Post: 04-03-2014, 02:02 PM
  3. Replies: 6
    Last Post: 05-10-2012, 08:20 PM
  4. Replies: 1
    Last Post: 09-20-2011, 03:23 PM
  5. Update query not updating records
    By toer121 in forum Queries
    Replies: 1
    Last Post: 08-25-2011, 07:08 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