View Single Post
  #4  
Old February 22nd, 2006, 12:14 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Select only negative numbered query results

I may have missed it, but I didn't see a clause in your SQL statement that
looks like:

WHERE xxxx 0

(where xxxx is the calculated value you first mentioned).

Where exactly are you putting the selection criterion?

Regards

Jeff Boyce
Microsoft Office/Access MVP


"la knight" wrote in message
...
I am using the Query Design Mode to enter fields, table, input, etc... And
I
have tried the "0" without the quotes for criteria and when I Run the
query
it pops up with an Input Data Paramater" box. Which I'm not sure what that
is
for. I just want to weed out the positives.

Here's the SQL: (I also have many other columns as you will notice)

SELECT V_INVENTORY_MSTR.PRODUCT_LINE AS [PR LINE], V_INVENTORY_MSTR.PART,
V_INVENTORY_MSTR.QTY_YTD_USAGE AS [PREV YTD],
V_INVENTORY_MSTR.QTY_CURRENT_USAGE AS [QTY YTD],
V_INVENTORY_MSTR.QTY_ONHAND
AS [ON HAND], V_INVENTORY_MSTR.QTY_REQUIRED AS REQRD, [ON HAND]-[REQRD] AS
[NET AVAIL], Sum(V_ORDER_LINES.QTY_ORDERED) AS [SO QTY],
V_INVENTORY_MSTR.QTY_ONORDER_WO AS [WO QTY],
First(V_ORDER_LINES.DATE_ITEM_PROM) AS [SHIP DUE],
First(V_JOB_HEADER.DATE_DUE) AS [WO DATE], V_JOB_HEADER.DATE_START AS [WO
START], V_JOB_HEADER.QTY_COMPLETED AS [QTY DONE],
Sum(V_ORDER_LINES.QTY_BO)
AS [BACK ORD]
FROM (V_INVENTORY_MSTR LEFT JOIN V_ORDER_LINES ON V_INVENTORY_MSTR.PART =
V_ORDER_LINES.PART) LEFT JOIN V_JOB_HEADER ON V_INVENTORY_MSTR.PART =
V_JOB_HEADER.PART
GROUP BY V_INVENTORY_MSTR.PRODUCT_LINE, V_INVENTORY_MSTR.PART,
V_INVENTORY_MSTR.QTY_YTD_USAGE, V_INVENTORY_MSTR.QTY_CURRENT_USAGE,
V_INVENTORY_MSTR.QTY_ONHAND, V_INVENTORY_MSTR.QTY_REQUIRED,
V_INVENTORY_MSTR.QTY_ONORDER_WO, V_JOB_HEADER.DATE_START,
V_JOB_HEADER.QTY_COMPLETED
HAVING (((V_INVENTORY_MSTR.PRODUCT_LINE)="20" Or
(V_INVENTORY_MSTR.PRODUCT_LINE)="17" Or
(V_INVENTORY_MSTR.PRODUCT_LINE)="19"
Or (V_INVENTORY_MSTR.PRODUCT_LINE)="50" Or
(V_INVENTORY_MSTR.PRODUCT_LINE)="52") AND
((First(V_ORDER_LINES.DATE_ITEM_PROM))#1/1/1900#))
ORDER BY V_INVENTORY_MSTR.PRODUCT_LINE, V_INVENTORY_MSTR.PART;


"Jeff Boyce" wrote:

You didn't post a copy of the SQL of your query. I suspect what you are
looking for is a selection criterion. If you are working in query design
mode, just add "0" (without the quotes) in the selection under that
field.

If you are working against a SQL statement in code, you'll need to look
into
using a WHERE clause.

Regards

Jeff Boyce
Microsoft Office/Access MVP

"la knight" wrote in message
...
Hello, just hoping for a bit of help on this one:

I have built a query which is linked via an ODBC database connection. I
have
added 3 linked tables to my query. In my query I have a field called
"NET
AVAIL". This field is a calculated field based upon the following
expression:

Field Input is NET AVAIL: [ON HAND] - [REQRD]
Table Input is -- Blank --
Total Input is Expression

The way I have this written now it querys and displays all of my
records
accurately, but it displays all my numbers which result in a positive
"NET
AVAIL" as well as a negative. I would like to filter this calculation
to
display on the results of this calculation which are negative.

I've tried many, many different things and just can't get it.
Any help is greatly appreciated! Thanks.