Solved

Access - A query needed to keep inventory based on Sales

Posted on 2007-04-07
5
256 Views
Last Modified: 2010-03-20
I can't seem to get this done, am frustrated as heck and would appreciate help...

I have two Access tables that I'm trying to query to get a running inventory and a quick glance of how much has been made on each against the cost of the items.

Table 1 - Named: Inventory
        Fields wanted: ITEMNBR (the Item Number), COST (My Cost) CQTY (How many I have in Stock)

Table 2 - Named: Sales
        Fields wanted: ItemID (the Item Number), Quantity (the quantity sold), PriceEa (price each the customer paid),                          TotalPrice (Quantity x PriceEa)

I want this:

ITEMNBR COST CQTY InStock(Inventory.CQTY - Sales.Quantity), SalesTotal (Sales.PriceEa x Sales.Quantity)


Now, here's the kicker. the Sales.PriceEa is not always the same for each item. And I have multiple lines for items in Inventory.ITEMNBR because my cost changes with each order that I make.

So, here's an example of my Sales Table:

ItemID      PriceEa      
AC2001       2.50
AC2001  0.75
AC2001  3.60

An Example of my Inventory Table:

ITEMNBR      Cost      CQTY
AC2001      1.50      2
AC2001      2.75      2

So I need Access to count the first two sales against the first AC2001 in the table and then, because that one is now out of stock, move to the second AC2001 and count the third sale again that.

I'd like it to look like this:

ITEMNBR      Cost      InStock      SalesTotal
AC2001      1.50      0      3.25
AC2001      2.75      1      3.60

I hope that this makes sense and is possible...

Thanks in advance for your help.
0
Comment
Question by:Mada123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 37

Accepted Solution

by:
momi_sabag earned 500 total points
ID: 18871931
hi

in order to achive what you want, you will have to provide some column that will allow to sort the rows
there is no way you can tell which ac2001 item was sold first and which was sold second if you don't have such a column, and it will be impossible to solve your problem
0
 

Author Comment

by:Mada123
ID: 18872286
I'm all for sorting rows and adding columns... I will change whatever is necessary to accomplish this. But I don't know what needs to be done. Can you please assist? Thanks much!
0
 
LVL 37

Expert Comment

by:momi_sabag
ID: 18872306
i guess the easiest thing to do would be to add a timestamp column (that is date+time)
that will hold for each row the date and time of the insert statement
that way you can keep track of which items were up to sell in every point in time
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question