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:

  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

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

Recommended Answers

All 4 Replies

That thread looks ok to me.

I did manage to get the code to format properly but I don't understand why it did not format properly as originally entered. here was a space between list item 2 and the code so it should have been recognized as code because it was properly indented.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.