By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,455 Members | 2,256 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,455 IT Pros & Developers. It's quick & easy.

calculating totals within a listbox

P: 49
I currently have an order form, where a customer can place order for items and each time they select a product and quantity then add button, this adds the item to the listbox with the quantity total for each 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 then i want to add all the totals up for this particular order from the listbox and display it within a textbox as the overall total which i have called =txttotalcost

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!!!

Any ideas?
Jan 28 '08 #1
Share this Question
Share on Google+
3 Replies


convexcube
P: 47
I currently have an order form, where a customer can place order for items and each time they select a product and quantity then add button, this adds the item to the listbox with the quantity total for each 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 then i want to add all the totals up for this particular order from the listbox and display it within a textbox as the overall total which i have called =txttotalcost

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!!!

Any ideas?
Hi Goldstar,

Have a look at this post. I placed the code in the AfterUpdate event of the list box.
As Missing Linq suggests, it might be better to use a subform for this, but this will do what you are asking for.

Kind Regards,
Ken Farrawell
Jan 29 '08 #2

P: 49
Hi Goldstar,

Have a look at this post. I placed the code in the AfterUpdate event of the list box.
As Missing Linq suggests, it might be better to use a subform for this, but this will do what you are asking for.

Kind Regards,
Ken Farrawell
Thanks Ken, Works a charm!!!

Just a quick query i am planning to have an edit button, that will allow records already within the text box to be edited, if so and that record is edited or deleted would the total change with the same code?
Jan 29 '08 #3

convexcube
P: 47
Thanks Ken, Works a charm!!!

Just a quick query i am planning to have an edit button, that will allow records already within the text box (list box?) to be edited, if so and that record is edited or deleted would the total change with the same code?
Hi Goldstar,

I'm assuming that by text box you mean the list box. Because the code is in the afterupdate event the total will be recalulated every time there is a change to it, so the answer is yes.

Kind Regards,
Ken Farrawell
Jan 29 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.