473,714 Members | 2,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

calculating the sum of a field in using access forms.

3 New Member
Dear All
i have the following problem and i am using microsoft access 2000 forms:-
i am working on a system for a store, and i have a table named orders (order id , order_date , order_price, order_company_o wner_name), and i have created a form for this table , what i am trying to do is that i want to add a field that calculate the sum of the prices for all the retrived orders (order_price) column for all the orders on the form that will be retrived after filtering the records (records - filter - filter by form) and i want the sum of those records to be calculted once the user click on the calculate button ?
thanks in advance
Sep 19 '07 #1
6 5688
puppydogbuddy
1,923 Recognized Expert Top Contributor
Dear All
i have the following problem and i am using microsoft access 2000 forms:-
i am working on a system for a store, and i have a table named orders (order id , order_date , order_price, order_company_o wner_name), and i have created a form for this table , what i am trying to do is that i want to add a field that calculate the sum of the prices for all the retrived orders (order_price) column for all the orders on the form that will be retrived after filtering the records (records - filter - filter by form) and i want the sum of those records to be calculted once the user click on the calculate button ?
thanks in advance
Use the DSum function over your filtered domain:

DSum("[order_price]", "YourFilteredQu ery")

Or use DSum with where clause (see example below)

DSum("[order_price]", "YourBaseQuery" , "order_date < Xdate")
Sep 19 '07 #2
lee123
556 Contributor
on the footer of the form add a text box in design view go to the properties of the text box find the controlsource and put this in the controlsource:

=sum(orderprice )

lee123
Sep 19 '07 #3
mazenblue
3 New Member
on the footer of the form add a text box in design view go to the properties of the text box find the controlsource and put this in the controlsource:

=sum(orderprice )

lee123
Many thnaks it works well , but i need to calculate the sum only when the user clicks on a button, not automatically.
Sep 19 '07 #4
mazenblue
3 New Member
any advice on how to calculate the sum of the prices only when i press on the calculate button???
Sep 20 '07 #5
puppydogbuddy
1,923 Recognized Expert Top Contributor
any advice on how to calculate the sum of the prices only when i press on the calculate button???

Here is one way that might work:
1. Set the visible property of the textbox with the calc to no in the forms current event.
2. Make it visible when you click the button:

Expand|Select|Wrap|Line Numbers
  1. Private Sub YourButton_Click()
  2. Me.YourTextbox.Visible = True
  3. End Sub
  4.  
  5. Private Sub Form_Current()
  6. Me.YourTextbox.Visible = False
  7. End Sub
Sep 20 '07 #6
puppydogbuddy
1,923 Recognized Expert Top Contributor
If you don;t want the calc to occur, visible or not, substitute enabled for visible in the above code.
Sep 20 '07 #7

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

Similar topics

25
5189
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"
2
3559
by: Omey Samaroo | last post by:
I have had many questions answered in this forum and I am trusting that one of the readers may help me find a simple solution. (1) Using a field called Date_Hired (type: Date/Time), how do I use a label to display a value that checks the current date, Date() and minus it from the date hired to show tenure displayed as Years Months Weeks and days ? (2) How do I use multiple option buttons with only one selected and if so it stores a...
25
10249
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab Control in the form, and in one of the tabs I have a subform (sfmSiblings) in which I wish to list...
4
2183
by: luscus | last post by:
I am trying to device a formula so that when i check of a yes/no box (done) it will automatically add the time in a field called "End Time" and at the same time stamp the amount of minutes between a field "begining Time" ( which already automatically stamps the time as you enter a new record) and the field "end time" For example : If I begun the new record at 2:45 PM worked on the problem untill 3:00 PM and solved it. I would then...
3
2720
by: luscus | last post by:
Thanks for all the responses on my first question. Unfortunately the answers I was given were too complicated for my small brain , and neophite condition to understand. So if you could talk down to me and write in easier terms I would be very gratefull to all you access wizards! Here is my problem. I have a table with maybe 10 fields, It is used to imput information taken over the phone to solve patient problems in our Spanish...
2
2533
by: kuhni | last post by:
Hi everybody! After searching newsgroups for a couple of hours, I now try asking directly (running the risk of asking again the same question). My problem is to predict when the size of the database (1GB I expect) is over 1GB by calculating the maximal number of data sets (tuple) added: 1. Is the following calculation for estimating the mdb file size in Access 97 correct: 1 integer field = 4 Byte
0
1785
by: robin9876 | last post by:
In an Access 2000 database on some forms 'Calculating...' is continuously displayed in the status bar window and the text of the control is automatically selected. The only workaround is switching to another application and back between each field that data is entered. I have tried this database on pc's that have office 2000 SP1a and SP3. How do investigate what is causing this calculating issue and how do I resolve it?
10
47818
by: tkq | last post by:
I have a normal table with customer information I have a DoB field and I want to have an automatic calculation that will show the age of the customer in another field next to it called Age Could you please help me with this Thanx all
9
9692
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a master-child link to the first subform. subform2 - Master Field: subTrainingModule.Form!TrainingModuleTopicSK Child Field: TrainingModuleTopicSK
0
8797
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
9309
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9071
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,...
0
9010
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5945
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
4462
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
4717
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3156
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
3
2107
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.