473,325 Members | 2,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

calculating the sum of a field in using access forms.

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_owner_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 5668
puppydogbuddy
1,923 Expert 1GB
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_owner_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]", "YourFilteredQuery")

Or use DSum with where clause (see example below)

DSum("[order_price]", "YourBaseQuery", "order_date < Xdate")
Sep 19 '07 #2
lee123
556 512MB
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
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
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 Expert 1GB
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 Expert 1GB
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
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...
2
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...
25
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...
4
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...
3
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...
2
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...
0
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...
10
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 ...
9
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.