I am working with the Inventory Dbase and I have a “Reorder Level” field which the quantity varies. I also have a query field Qty On Hand
[PHP]Qty On Hand: Sum([Material Inventory Tran]![Qty Received]-[Material Inventory Tran]![Qty Issued])[/PHP]
I’m trying to make a query to show all "Qty On Hand" that is less than the "Reorder Level". How do I make that Statement.
Thanks
John
9 1552
Is there only one record in your reorder table? If so then select from your on hand query where Quantity On Hand < tblReorder.ReorderLevel. For instance if you call your on hand query OnHand_qry and your Reorder table Reorder_tbl then the query would be: -
Select OnHand_qry.QuantityOnHand FROM OnHand_qry, Reorder_tbl
-
WHERE OnHand_qry.QuantityOnHand < Reorder_tbl.ReorderLevel
-
NeoPa 32,556
Expert Mod 16PB
Is the [Reorder Level] field found in the same recordset that the query is run from? You should really include the relevant information in the question John.
Is the [Reorder Level] field found in the same recordset that the query is run from? You should really include the relevant information in the question John.
Yes- The "Reorder Level" field is in the same recordset that the query is run from. I'm having a hard time since that the "Qty On Hand" is an expression otherwise I can do some thing like "Qty On Hand<= Reorder Level" and it just doesn't work.
I'll try the first suggestion. Thank you for the reply!
NeoPa 32,556
Expert Mod 16PB
No. It won't.
This is because the WHERE and HAVING clauses are processed before the SELECT clause.
You probably need something like : - ...
-
FROM [Material Inventory Tran]
-
GROUP BY ???
-
HAVING (Sum([Qty Received]-[Qty Issued])<[Reorder Level])
NeoPa 32,556
Expert Mod 16PB
If that's a bit confusing for you, pop your existing SQL code in here and we'll see what we can do for you.
Here's the existing SQL Code:
Thanks again!
[PHP]SELECT [Material Inventory].[Part Number], [Material Inventory].[Alternate Part Number], [Material Inventory].Description, [Material Inventory].Rev, [Material Inventory].[Unit of Measure], [Material Inventory].Location, Sum([Material Inventory Tran].[Qty Received]) AS [SumOfQty Received], Sum([Material Inventory Tran].[Qty Issued]) AS [SumOfQty Issued], Sum([Material Inventory Tran]![Qty Received]-[Material Inventory Tran]![Qty Issued]) AS [Qty On Hand], [Material Inventory].[Reorder Level]
FROM [Material Inventory] RIGHT JOIN [Material Inventory Tran] ON [Material Inventory].MIID = [Material Inventory Tran].MIID
GROUP BY [Material Inventory].[Part Number], [Material Inventory].[Alternate Part Number], [Material Inventory].Description, [Material Inventory].Rev, [Material Inventory].[Unit of Measure], [Material Inventory].Location, [Material Inventory].[Reorder Level]
HAVING (((Sum([Material Inventory Tran]![Qty Received]-[Material Inventory Tran]![Qty Issued]))>0));[/PHP]
NeoPa 32,556
Expert Mod 16PB
Try this - and notice how it's laid out to be legible and understandable. It really makes life so much easier for you. - SELECT MI.[Part Number],
-
MI.[Alternate Part Number],
-
MI.Description,
-
MI.Rev,
-
MI.[Unit of Measure],
-
MI.Location,
-
Sum(MIT.[Qty Received]) AS [SumOfQty Received],
-
Sum(MIT.[Qty Issued]) AS [SumOfQty Issued],
-
Sum(MIT.[Qty Received]-MIT.[Qty Issued]) AS [Qty On Hand],
-
MI.[Reorder Level]
-
-
FROM [Material Inventory] AS MI RIGHT JOIN [Material Inventory Tran] AS MIT
-
ON MI.MIID=MIT.MIID
-
-
GROUP BY MI.[Part Number],
-
MI.[Alternate Part Number],
-
MI.Description,
-
MI.Rev,
-
MI.[Unit of Measure],
-
MI.Location,
-
MI.[Reorder Level]
-
-
HAVING (Sum(MIT.[Qty Received]-MIT.[Qty Issued])>=MI.[Reorder Level])
THANK YOU VERY MUCH!!!! I'll try it.. Sorry for slow response- just got back from work!
John
NeoPa 32,556
Expert Mod 16PB
You're welcome - and no worries about any delay. We don't expect anyone to be online all the time.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: majsen |
last post by:
Hi, I have problem running this query. It will time out for me...
My database are small just about 200 members.
I have a site for swaping appartments (rental). my query should look
for match
in...
|
by: Együd Csaba |
last post by:
Hi All,
how can I improve the query performance in the following situation:
I have a big (4.5+ million rows) table. One query takes approx. 9 sec to
finish resulting ~10000 rows. But if I run...
|
by: John Ortt |
last post by:
> I have a table of dates in ascending order but with varying intervals. I
> would like to create a query to pull out the date (in field 1) and then
pull
> the date from the subsequent record...
|
by: Ekqvist Marko |
last post by:
Hi,
I have one Access database table including questions and answers. Now
I need to give answer id automatically to questionID column. But I
don't know how it is best (fastest) to do?
table...
|
by: serge |
last post by:
How can I run a single SP by asking multiple sales question either
by using the logical operator AND for all the questions; or using
the logical operator OR for all the questions. So it's always...
|
by: jjturon |
last post by:
Can anyone help me??
I am trying to pass a Select Query variable to a table using Dlookup
and return the value to same select query but to another field.
Ex.
SalesManID ...
|
by: mmitchell_houston |
last post by:
I'm working on a .NET project and I need a single query to return a
result set from three related tables in Access 2003, and I'm having
trouble getting the results I want.
The details:
...
|
by: Stan |
last post by:
I am working with Access 2003 on a computer running XP. I am new at
using Access. I have a Db with a date field stored as mm/dd/yyyy. I
need a Query that will prompt for the month, ie. 6 for...
|
by: Richard Hollenbeck |
last post by:
I am very sorry about the (almost) re-post, but you will see that my first
question wasn't very clear; I have another question I posted this morning
called, "in DAO: Run time error 3061 Too few...
|
by: ARC |
last post by:
Hello all,
So I'm knee deep in this import utility program, and am coming up with all
sorts of "gotcha's!".
1st off. On a "Find Duplicates Query", does anyone have a good solution for...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |