Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have a table in an Access database. Two of the columns contain the data I wish to calculate (Cost * Quantity)= X, this has to apply to each record. Once I have the value X it then needs to be added to the value of X in the next record and so on until the last record is reached. The new value Y ( Sum of Xs) is what I am after to display in a textbox on a form. I have never done calculations using VB and require an example of how I could achieve this.
I have used data control for the form & table and an example of the code I would use to define say Cost would be:
datTable.Recordset.Fields("Cost")
so this would need to be multiplied by
datTable.Recordset.Fields("Quantity")
and allWhile Not datTable.Recordset.EOF
Could someone please show me how to juggle this little lot so I can display the total value of all the products in the table to the textbox on the form.
Regards
M

![]() |
what differs between c++ ...
|
javascript problem
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |