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"
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"
"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
JeffChr
I do not understand your answer so I changed my expression to eliminate the NZ:
avail: ([SumOfIn]-[SumOfOut])
any idea for Criteria?
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.
june7
The query runs correctly, without the NZ function, showing records with 0 inventory. I need to find a way to suppress those records.
Place "Not 0" in the criteria cell for the [avail] field in your query (don't include the quotes)
JeffChr,
When I do that I get a box that says "Enter Parameter Value" for sumofin.
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.
June7,
I don't do SQL. I just enter data on the database. My expression is avail: ([SumOfIn]-[SumOfOut])
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.
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;
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.
Thanks for trying.
this has been resolved
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.