Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    George Pollow is offline Advanced Beginner
    Windows 7 32bit Access 2000
    Join Date
    May 2014
    Posts
    30

    in Access 2013 use criteria to check result of expression

    I am trying to suppress records with 0 inventory. This is my expression:
    avail: ([SumOfIn]-[SumOfOut])



    What do I key on the Criteria line to suppress records with 0 in "avail"

  2. #2
    JeffChr is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    82
    "If you use the Nz function in an expression in a query without using the valueifnull argument, the results will be a zero-length string in the fields that contain null values." http://msdn.microsoft.com/en-us/library/office/ff195223%28v=office.15%29.aspx

    I think you need a valueifnull argument because you cannot subtract two strings: (Nz([SumOfIn], 0)-Nz([SumOfOut], 0))

    and your criteria could be: Not 0

  3. #3
    George Pollow is offline Advanced Beginner
    Windows 7 32bit Access 2000
    Join Date
    May 2014
    Posts
    30
    JeffChr

    I do not understand your answer so I changed my expression to eliminate the NZ:
    avail: ([SumOfIn]-[SumOfOut])

    any idea for Criteria?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    If you want to test for 0 then probably should use the Nz() function because arithmetic with Null results in Null. If either Sum is Null then the calc result will be Null.

    Why don't you try the expression Jeff provided?
    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.

  5. #5
    George Pollow is offline Advanced Beginner
    Windows 7 32bit Access 2000
    Join Date
    May 2014
    Posts
    30
    june7

    The query runs correctly, without the NZ function, showing records with 0 inventory. I need to find a way to suppress those records.

  6. #6
    JeffChr is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    82
    Place "Not 0" in the criteria cell for the [avail] field in your query (don't include the quotes)

  7. #7
    George Pollow is offline Advanced Beginner
    Windows 7 32bit Access 2000
    Join Date
    May 2014
    Posts
    30
    JeffChr,

    When I do that I get a box that says "Enter Parameter Value" for sumofin.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Post the complete SQL statement.
    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.

  9. #9
    George Pollow is offline Advanced Beginner
    Windows 7 32bit Access 2000
    Join Date
    May 2014
    Posts
    30
    June7,

    I don't do SQL. I just enter data on the database. My expression is avail: ([SumOfIn]-[SumOfOut])

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    You have a query object then you do have SQL. Query objects use SQL. Switch to SQL View to see the statement.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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.

  11. #11
    George Pollow is offline Advanced Beginner
    Windows 7 32bit Access 2000
    Join Date
    May 2014
    Posts
    30
    SELECT [Pubs Subject].Subject, [Pubs Basic].Title, [Pubs Basic].Comment, Sum([Pubs Transaction].[In]) AS SumOfIn, Sum([Pubs Transaction].Out) AS SumOfOut, ([SumOfIn]-[SumOfOut]) AS avail
    FROM ([Pubs Basic] INNER JOIN [Pubs Transaction] ON [Pubs Basic].[Rec_Nbr] = [Pubs Transaction].[Rec_Nbr]) INNER JOIN [Pubs Subject] ON [Pubs Basic].Rec_Nbr = [Pubs Subject].Rec_Nbr
    GROUP BY [Pubs Subject].Subject, [Pubs Basic].Title, [Pubs Basic].Comment;

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I don't use many aggregate queries and can't remember if filter criteria can be applied to a field calculated from two aggregate fields. Apparently there is an issue with that.

    Think I will have to work with your db to further analyze this issue.
    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.

  13. #13
    George Pollow is offline Advanced Beginner
    Windows 7 32bit Access 2000
    Join Date
    May 2014
    Posts
    30
    Thanks for trying.

  14. #14
    George Pollow is offline Advanced Beginner
    Windows 7 32bit Access 2000
    Join Date
    May 2014
    Posts
    30
    this has been resolved

  15. #15
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Want to share how?
    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.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 15
    Last Post: 11-18-2013, 10:49 PM
  2. Expression with mixed value result
    By chelseasikoebs in forum Access
    Replies: 2
    Last Post: 10-23-2013, 09:18 AM
  3. Replies: 5
    Last Post: 09-25-2013, 09:35 AM
  4. Replies: 1
    Last Post: 05-09-2013, 07:54 PM
  5. Replies: 3
    Last Post: 07-12-2010, 01:38 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