Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to multiply two fields and display the answer in a listbox... 1

Status
Not open for further replies.

marlun

Programmer
Feb 7, 2003
70
SE
Hi! I have problem with some calculations.
In a table I have fields called Price and Amount.
The form is working like follows. I have a form that will calculate the total cost in a storage. First I choose in which business area, ID or NSS. Then I choose between two dates. Then I want it to multiply Price*Amount and add all posts. Price*Amount + Price1*Amount1 + Price2*Amount2...

Hope you understand my problem

thanks
 
Hi

Make a query based on your tbale, but with Criteria of Between FromDate and ToDate

In the query include a column Amount as a calculated column,
Amount:price*qty

Now depending on if you actually want the details or only the total, make it an aggregate query summing on Amount Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Hi again. I understand fromDate and ToDate. When I put in the dates in the fields, I get a long list of products. I want to multiply qty with Price of all the products in the list and then sum all the prices, so I get a totalprice for all products. Dont understand how to write thew query or VB to accomplish that.

Hope someone out there can give me a hint.

 
Hi

In the query design grid, if you do not have the toolbars, displayed, then dispaly the query design toolbar,

from the tool bar click the icon which looks a bit like a letter E

this will convert you simple select query into an agregate query

if you just want one value (ie the Grand total), delete all columns from your query, except the amount

under the name (Amount) it will probably say 'Group By' change this to SUM and run your query

you should not need any VBA just the query Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top