total cost displayed

goldstar1982

Registered User.
Local time
Today, 11:01
Joined
Jan 27, 2008
Messages
10
Hi,

I have a order system which allows customers to place items on. When an item is selected and a quantity has been entered and add button is selected, this adds the item into a listbox with all the details.
Each item that is selected a quantity is selected, this would then work out a total price and this total would be displayd within the list box too.
i want to add all the totals up for that order and have it displayed within a text box.

for example:

product ID, Name, quantiy, item price, totalcost
P0001 Top 5 1.00 5.00
P0002 Top 4 2.00 8.00
P0003 Top 3 1.00 3.00


i then have a text box where i want to display the overall total for these items within. hope this helps. im really stuck on this one!!!
 
In your text box for the total enter

=Sum([TotalCost])

Don't forget the tax.
 
No luck, it mentions Sum is not defined, am i suppose to be putting this within the txt field? under what event shall i write the code (on enter?)
 
You make an unbound text box and put =Sum([YourField]) in the Data section of the text box.

Doing it in a query is quite different. For a query, go to the top of the toolbar in Query Design and you will see a funny looking E. Click on the E and then you will see Group By appear in the query grid. If you click on a Group By there will be a drop down list of several options such as Sum, Count and so on.

Such a query will produce a single record and you will have a field that is SumOfYourField

Doing it in the unbound textbox is very flexible. The "answer" will automatically adjust if you filter records. You can also use one unbound text box to provide the data for another unbound textbox. Using unbound textboxes containing formulas is very similar to using Excel
 

Users who are viewing this thread

Back
Top Bottom