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

Home Posts Topics Members FAQ

How to create a sum in a query where the sum is based on a sub form

3 New Member
i think im confusing myself here but ill try my best to explain

i have a form where cds can be purchased, within it is a subform which allows a user to choose from a combo box of all the cds

Now i got a textbox to display the sum of the prices using =sum([prices])
but i need to put that sum into a query, i understand you can do the total: [price1]+[price2] in order to add prices up but because my prices are based within a sub form i only have 1 price field and therefore can only add them up using the unbound textbox =sum([prices])

is there anyway of doing somthing similar in a query? oh and i have tried putting total:sum([prices])

thanks
May 9 '10 #1
6 2363
Jerry Maiapu
259 Contributor
Why do you have to put sum([prices]) into a query? if the unbound textbox =sum([prices]) is on the parent form form then what is the problem..

Give the table detaisl from which you forms (Parent +child) is based on and tell us what you are trying to achieve rather than mentioneing wha you'would like to do..nad maybe we maight help..
I screen shot would be a good idea as well..

JM
May 10 '10 #2
feed the inferno
3 New Member
Hey sorry I forgot to mention what i'm trying to get out of it, I'm creating a query so that I can make a report based on a transaction number that will display what items the customer has chosen and a final total price. I know it's bad practice to store the total price so I'm trying to put the sum in the query

so basically I need a recipt in the form of a report with a total price on it

I'm not at my computer at the moment so I cannot get a screenshot but if one is required I will get one later

thanks
May 10 '10 #3
NeoPa
32,569 Recognized Expert Moderator MVP
Assuming the correct names the following should work in a query :
Expand|Select|Wrap|Line Numbers
  1. Total:=Sum([Prices])
Welcome to Bytes!
May 10 '10 #4
feed the inferno
3 New Member
Nope i put that I tried that in the first post, it errors and doesn't work I'm afraid
May 10 '10 #5
NeoPa
32,569 Recognized Expert Moderator MVP
I guess you want the query to show both detail and aggregate data then. I misunderstood your question as most realise that is not how queries work (except by fiddling a fair bit).

If you are using a form with a subform, then your easiest route to showing a sum of the items on your subform, on your main form, is to create an unbound control (TextBox) in the Footer section of your subform, which can either be visible or hidden depending on your choice, and refer to that item (See Referring to Items on a Sub-Form) in another TextBox control on your main form.
May 10 '10 #6
Jerry Maiapu
259 Contributor
I don’t know if I am on the right track but I think you need to have a nested (sub query) to do that. But Ill show you how to use two different queries like what I do as am not good at nested sub queries..

First run query wizard for the two tables (assuming they have 1-many relationship: also assuming that the many side contains the CD names and its prizes).
Select the necessary fields and save the query.

Now run query wizard and create another query based on the last query you created.
Go to design view and click the Totals button.

On the sort row leave the GROUP BY clause and select SUM for the prices.

When you run the query you’ll see a single row for each item with their tolal price.
Create your report based on this summary query.

Tell me if I am wrong somewhere.

Regards

Jerry
May 11 '10 #7

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

Similar topics

2
5683
by: JDJones | last post by:
Using PHP and MySQL. Trying to put a list of categories into a drop down select option of a form like: <form name="form" action="<? print $_SERVER?>" method="get"> <select name="subject"> <option value=""></option> <option value="field1">Field 1</option> <option value="field2">Field 2</option> </select>
4
6275
by: James | last post by:
Dear group, Can anyone tell me how to do the following? I have a basic list of numbers in a table I want to be able to search these by letting the user type "<10" or ">=50" on a simple form that has a list box showing the results I have tried creating a query that uses the criteria the user types on
1
4178
by: Matthew | last post by:
Hey, I have built a form that has certain combo and text boxes on it, which a user specifies his criteria and then clicks on a search button to run a query based on that criteria. To build to this, I want to add check boxes on this form, with the names of some of the fields in my query, where if unchecked, the query will still run like before, but will not show the unchecked fields anymore. Can I do this?
3
1974
by: dskillingstad | last post by:
I'd appreciate any help I can get. I'm not sure what I'm doing wrong, but.... I've searched these groups for some solutions but no luck. I have an unbound form (frmSearch), with several unbound text boxes on it and a command button bound to a macro which fires off a parameter query based on the criteria/string that the user types into the text boxes on frmSearch. My goal is to create a search form where the user can search by any of...
2
9341
by: amith.srinivas | last post by:
Hi all, From a word macro in VBA, I am trying to create a report in access DB. The report is based on a query with a parameter. I am using Set rpt = Application.CreateReport rpt.RecordSource = <<Query_Name>> Once I create the report, I m trying to create labels to display the Report title in the Report Header section.
5
2931
by: Kaspa | last post by:
I am creating a contact database and I would like the user to create his own groups of contacts based on criterias, thefore I would like to let him pick the fields and criteria for a particular group. I don't wanna a form full of fields that ask the user for arguments. Instead a subform with a combobox where the user picks the , the , and the So I would have two tables groups and GroupCriteria for instance: group field ...
7
2270
by: J-P-W | last post by:
Hi, in the past I've spent ages writing VB routines to get around this problem, is there a simple way? I have three tables for a membership system: tblMembership - MembershipNumber; Names etc tblMembershipSubsHeader - "AmountDue" ; whether the pay by standing order and so on tblMembershipSubs - PaymentYear ; DatePaid; AmountPaid
7
3614
IGGI
by: IGGI | last post by:
Looks like this is the best place for the right Answers. Got a database that stores users skills, "Leader", "Investigator","Engineering" ect in a "personnel" table, A form called "Search Query" with uncontrolled Check boxes namely "Cleader","CInvestigator","CEngineering" and so on. When the users checks some of these boxes, I need to build a query based on the "Personnel" Table, plus all form selections to display all fields that meet the...
5
10266
by: Ferasse | last post by:
Hi, I'm an occasional Ms-Access developer, so there is still a lot of stuff that I don't get... Right now, I'm working on a database that stores contractual information. One of the form that I created is based on a query that links several tables. When I try to insert a record in this query-based form, I can only update the fields that are used to build relations with other tables.
1
1194
by: samtymom | last post by:
I have a database that is used for Salvage Vehicles. (At present I am using 2002, but will be moving to 2007 shortly.) Presently there is a Switchboard that opens the Form View of the Salvage table. I need a "Popup Form" to open where "Non-Access" users can enter one of 5 or 6 different fields and then have that vehicle show in the Form view with all it's data. They may enter one of Unit #, Serial8, License Plate, etc... Could...
0
8485
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
8930
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...
0
8828
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8605
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
7446
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6238
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
5704
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
4227
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...
2
1816
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.