Query to filter based on minimum value

anto.danny

Registered User.
Local time
Today, 13:23
Joined
Nov 8, 2015
Messages
35
Greetings,

I have table named stock which has a minimum level for items and stock levels at each branch, so the table would have columns Item_name, Minimum_level, North_stock, South_stock, East_stock, West_stock.

Now I want a report that shows items which have gone below the minimum level. As all the branch stock level are in the same table, I don't mind even if the report shows branch's that have stock beyond the minimum level.

I made a report and added query <=[Minimum_level] under all branch in record source.

But the report shows only items that are below minimum level at all four branch's. I want the report to show items that are below minimum level even in a single branch.
 
on your query criteria:

Where (Val(0 & [North_Stock]) < [Minimum_Level]) Or (Val( 0 & [South_Stock]) < [Minimum_Level]) Or (Val(0 & [West_Stock]) < [Minimum_Level]) Or (Val(0 & [East_Stock]) < [Minimum_Level])
 
I get "Undefined function 'where' in expression."
 
sorry about that:

Where (Val("0" & [North_Stock]) < [Minimum_Level]) Or (Val( "0" & [South_Stock]) < [Minimum_Level]) Or (Val("0" & [West_Stock]) < [Minimum_Level]) Or (Val("0" & [East_Stock]) < [Minimum_Level])
 
That's a no go, I get the same pop up..I added the query to criteria of all the branch.:confused:
 
what do you mean by "same pop up".
 
when I open the report i get "Undefined function 'where' in expression."
 
ok, can you show me your sql query, is it based on another query?
 
Where (Val("0" & [TBK Stock]) < [Minimum Level]) Or (Val( "0" & [TIF Stock]) < [Minimum Level]) Or (Val("0" & [DHN Stock]) < [Minimum Level]) Or (Val("0" & [RUH Stock]) < [Minimum Level])

I added this on criteria of all the branch.
 
ok, i see, can you also post the record source of your report.
 
Do you create your query using the query builder? if so, can you put a picture of it?
 
I don't use query builder. I click on the record source and it opens up the query, I type the condition in the Criteria of the columns. See attachment :o:(
 

Attachments

  • Untitled.png
    Untitled.png
    63.7 KB · Views: 65
go to SQL view and paste that code:

SELECT * FROM [Parts List] WHERE (Val("0" & [TBK Stock]) < [Minimum Level]) Or (Val( "0" & [TIF Stock]) < [Minimum Level]) Or (Val("0" & [DHN Stock]) < [Minimum Level]) Or (Val("0" & [RUH Stock]) < [Minimum Level])
 
now it shows the entire list. Its like there is no condition. When you find time could you make a sample so I could understand what I'm doing wrong
 
your query will show you any branch that has its stock below minimum level. can you see in the report that it does show this? or at least one branch? if so, then our criteria is correct. or is there anything else you want to show or not to show?
 
thank you..Its working.:):):):):):)

P.S Please be on the look out for my next thread..:P
 

Users who are viewing this thread

Back
Top Bottom