getting total ordered displayed

goldstar1982

Registered User.
Local time
Today, 10:33
Joined
Jan 27, 2008
Messages
10
i will have be displaying product total. so each prodcut that is added, within the listbox will be displayed the total for that item ,

for example quantity= 10 * 19.99each the total 199.99 for each line will be displayed, i could get this to work so it adds the the total for each line to the listbox.
But now i want to add the total of each line in the listbox and display it in a text box which i have called = txttotalcost

thanks again
 
I would write a query that accepts some key value and sums the lines up. Then use that as the basis of your textbox. You may have to requery it depending on how your form/s work.
 
10 * 19.99 = 199.90, but who's counting? ;)

Anyway, I don't get your question. Do you just want to take the total of each item in the listbox and then display that in a textbox?

For example, if this is your listbox and the bold entries are "selected":

Code:
[b]ItemA    $20[/b]
ItemB    $10
ItemC    $50
[b]ItemD    $15[/b]

You want the textbox to display the totals for ItemA and ItemD, as in $35? And where is the quantity coming from?

If my guess is right above, then you loop through the listbox entries (use a For Each) and test each entry on the IsSelected property. If that's true, add the dollar amount to the total.

My guess is that I'm sort of close, but the description wasn't clear, so see if you can describe what the situation is a little bit more precisely.
 
lol 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 total for these items within. hope this helps. im really stuck on this one!!!
 
Post that this way (use CODE tags, the # thing in the toolbar). You'll get better responses using that. Anyway:

Code:
product ID   Name    quantity  item price   totalcost
P0001        Top     5         1.00         5.00
P0002        Top     4         2.00         8.00
P0003        Top     3         1.00         3.00

Why can't you just use a DSum on the TotalCost field, as in:

YourTextboxValue = DSum("YourTotalCostFieldName","YourTableName")

That would set YourTextboxValue to $16.00.
 

Users who are viewing this thread

Back
Top Bottom