473,790 Members | 3,200 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

calculating totals within a listbox

49 New Member
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
3 4078
convexcube
47 New Member
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
goldstar
49 New Member
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
47 New Member
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

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

Similar topics

4
4867
by: The Bit Bandit | last post by:
Hopefully someone can help me create a query that I'm having some trouble with. I have three tables: invoices, invoicedetails, invoicepayments The fields are: invoices -------- InvoiceNo
25
5199
by: kie | last post by:
hello, i have a table that creates and deletes rows dynamically using createElement, appendChild, removeChild. when i have added the required amount of rows and input my data, i would like to calculate the totals in each row. when i try however, i receive the error: "Error: 'elements' is null or not an object"
3
1664
by: Paul Mendez | last post by:
Performance_Date SumOfBudget_NOI CurrYTD_BudgetNOI_Total 1/1/2004 $4,184,626.00 ? 2/1/2004 $4,484,710.00 ? 3/1/2004 $4,537,424.00 ? 4/1/2004 $4,826,850.00 ? 5/1/2004 $4,966,326.00 ? Can someone help? What I am trying to do is create a query that will end up looking like the bottom example. The above query is a calculated totals query with an...
2
35898
by: mhodkin | last post by:
I created a query in which I have grouped data by City. I wish to calculate the percent of each value, e.g. City/(Total count of all Cities), in tbe next column of the query. I can't seem to write the correct expression due to the "groupby" needed to group the city count in the first column. Any clues?
2
2313
by: Tim Marshall | last post by:
Wondering if anyone has any suggestions for this. Sometimes in the form reports my users run, a data sheet subform on a main form, with totals in text boxes with calculated controlsources (=sum(whatever)), the records returned are large. By "large" I mean that there is a significant lag time before the totals get calculated and display. Lag time and what constitutes "large" varies with the user's PC hardware/configuration.
5
9436
by: jonm4102 | last post by:
I'm trying to calculate the median of some numerical data. The data can only be found in a query (henceforth query 1) field I previously made, and I would prefer to calculate the median in a new query it without making a table out of query 1. I can't find a median function in the "Total" field, so is there so way to make an expression to calculate the median of the orignial data from query 1 in my new query? Also, what does name by...
10
2849
by: rdemyan via AccessMonster.com | last post by:
I have a subform that displays around 10 fields. Most of the values shown result from some complex calculations. To make it easy, I have stored the results in a temporary table and then all I need to do is set the recordsource of the subform equal to the table. However, it would be very nice if the last row in the subform showed the totals of the previous rows (of course where applicable). If it were a listbox (that didn't require...
2
1877
by: mtchampi | last post by:
Hello all, I have a limited SQL background, and I am responsible for creating a monthly report that displays separate tables for the following: 1. Calculate individual monthly totals of files processed (created) that month 2. Accumulating totals per month, (eg. Jan 200 files, Feb 300 files, so Feb would now read as 500 files) 3. Take a constant number, say 10,000 records, subtract the year to date result(from the accummulating totals)...
38
9148
by: d0ugg | last post by:
I'm writing a program that will have to roll the dice A and dice B one million times, and calculate the percentage of times that the dies will be equal. I'm having trouble to figure out how the percentage will work. Here is my code: #include <ctime> #include <iostream> using namespace std;
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9512
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10147
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7531
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6770
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5424
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5552
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4100
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3709
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.