Results 1 to 4 of 4
  1. #1
    Jessica240 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    95

    One Update Query to Update several fields simultaneously

    Hello all! Thank you in advance for your help to what seems a rather simple problem.



    I have one table with several blank records in different fields. I simply need anything that is blank to be replaced with a zero. For some reason, when I try to design the query to update several fields at once, it does not work. I have attached 2 screen shots: in the design view, you can see that I have put "0" in the update to area. And I put "Is Null" for the criteria. But then, if you look at the table view, you can see that after I ran the query, some records were not updated - they are still blank.

    Also I have noticed that the more fields I add to my query design, the less rows get updated. For example, when I try only updating one field, all 9 records get updated. But when I try updating 5 fields and click "run" then the window will pop up saying I'm about to only update 7 rows.

    I'm not very familiar with SQL so if anyone could help me out with the design view that would be great! Thank you!
    Attached Thumbnails Attached Thumbnails Table View.PNG   Design View.PNG  

  2. #2
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    Use NZ(TABLENAME.FIELDNAME, 0) in place of "UPDATE TO" are.
    You don't need the criteria "IS NULL"

    http://www.techonthenet.com/access/f...dvanced/nz.php

  3. #3
    Join Date
    May 2014
    Location
    Virginia
    Posts
    5

    My bad

    Currently you are saying that all three have to be null at the same time.

    The previous note is better than mine.

    If you do this over and over you could do three separate updates and then put all three updates in a macro.

    Obviously, Not as efficient as the first poster.

    Sorry for my change as the last option was wrong.
    Last edited by msaccess2&beyond; 05-27-2014 at 09:05 AM. Reason: Too quick

  4. #4
    Jessica240 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    95
    Thank you both! I didn't realize that by putting in "is null" in all three fields' criteria, that that would require them all to be null at the same time. Very good to know. Problem solved!

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

Similar Threads

  1. Replies: 1
    Last Post: 03-11-2013, 07:36 PM
  2. Replies: 2
    Last Post: 08-30-2012, 07:59 AM
  3. Update fields via query
    By bigroo in forum Queries
    Replies: 8
    Last Post: 04-26-2012, 04:21 PM
  4. UPDATE query with many fields
    By Deutz in forum Queries
    Replies: 7
    Last Post: 08-23-2011, 05:53 PM
  5. Cant update fields when using a query
    By JohnBoy in forum Queries
    Replies: 4
    Last Post: 06-12-2010, 01:13 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