While browsing this thread I noticed that the code was unformatted. Mr. Waddell is well aware of how to format code so I was surprised. When I went to edit the code, however, I saw that it was formatted correctly. Here is a section of the code as originally entered
Wow! Thats a lot of Code to go through!
So I'll just go back to your question... You have a list of items and for each item you want to give total in stock and cash value.
OK there are two ways to do this:
Through a SQL query using SUM on the quantity and on the total and grouping by the other item fields :
SELECT itemno, name, SUM(qty) As qty, price, SUM(Total) as Total FROM tblInventory GROUP BY itemno, name, price
Or as you said by looping through the records:
dim itemNo, CurrentItem as integer
dim ItemName as string
dim UnitPrice as decimal
I had to reformat it as follows to get the code block to display properly
1.Through a SQL query using SUM on the quantity and on the total and grouping by the other item fields : SELECT itemno, name, SUM(qty) As qty, price, SUM(Total) as Total FROM tblInventory GROUP BY itemno, name, price
2. Or as you said by looping through the records:
dim itemNo, CurrentItem as integer
dim ItemName as string
dim UnitPrice as decimal