Results 1 to 4 of 4
  1. #1
    Jerseynjphillypa is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Apr 2012
    Posts
    83

    Null to 0

    I am trying to get my field name Saved Null to 0 but it is not working. Since the field is left blank where there is no saving

    I tried the following


    Nz([Saved],0)
    Iff([Saved] is Null,0,[Saved])

    I am not sure if I am typing in the function correctly since I just recently started using Access. Or is it because I am using the Sum Total Function.

    Sorry but I just recently started using Access and learning as I go.
    Attached Files Attached Files
    Last edited by Jerseynjphillypa; 04-05-2012 at 07:58 AM. Reason: How to Append

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Only problem I had with the query was a circular reference on the Saved field. The following worked:
    SELECT Amount.Item, Amount.Date, Supply.Supply, Supply.Purchaser, Supply.Location, Sum(Amount.Cost) AS SumOfCost, Sum(Amount.Spend) AS SumOfSpend, Sum(Nz([Saved],0)) AS SavedAmt INTO [Total Purchase]
    FROM Supply LEFT JOIN Amount ON Supply.Supply = Amount.Item
    GROUP BY Amount.Item, Amount.Date, Supply.Supply, Supply.Purchaser, Supply.Location;

    If you use SELECT INTO the Total Purchase table will be deleted first. Is this what you want to happen every time? To actually append records use INSERT SELECT.
    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
    Jerseynjphillypa is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Apr 2012
    Posts
    83
    Quote Originally Posted by June7 View Post
    Only problem I had with the query was a circular reference on the Saved field. The following worked:
    SELECT Amount.Item, Amount.Date, Supply.Supply, Supply.Purchaser, Supply.Location, Sum(Amount.Cost) AS SumOfCost, Sum(Amount.Spend) AS SumOfSpend, Sum(Nz([Saved],0)) AS SavedAmt INTO [Total Purchase]
    FROM Supply LEFT JOIN Amount ON Supply.Supply = Amount.Item
    GROUP BY Amount.Item, Amount.Date, Supply.Supply, Supply.Purchaser, Supply.Location;

    If you use SELECT INTO the Total Purchase table will be deleted first. Is this what you want to happen every time? To actually append records use INSERT SELECT.

    I would want the table to append records, so where would I use the command INSERT SELECT.

    Also would I need to first create the table using SELECT INTO and then change it to INSERT SELECT so the records will append to the table.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Yes, you could use the SELECT INTO one time or manually build table. Then just use the INSERT SELECT thereafter. Use the command INSERT SELECT in sql statement.

    http://msdn.microsoft.com/en-US/libr...=SQL.105).aspx
    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: 1
    Last Post: 02-23-2012, 02:27 PM
  2. Finding the Max Date and Null Values if Null
    By SpdRacerX in forum Queries
    Replies: 1
    Last Post: 02-03-2012, 06:29 AM
  3. Passing criteria "NULL" or "IS NOT NULL" to a query
    By SgtSaunders69 in forum Forms
    Replies: 1
    Last Post: 12-24-2011, 02:22 AM
  4. Update field1 if Null, if Not Null update field2
    By mfirestorm in forum Queries
    Replies: 2
    Last Post: 12-02-2011, 09:51 AM
  5. Is Null
    By 1943 in forum Access
    Replies: 3
    Last Post: 02-21-2011, 02:33 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