Queries :: Sum Calculated Query Without GroupBy Totals?

Jul 11, 2013

Im trying to run the following calculated query:

Total Value on order: Sum([Purchase Price])

I want to sum the total of all the purchase prices together so I know the total value on order. I keep getting an error: "You tried to execute a query that does not include the specified expression Purchase Order' as part of an aggregate function

View Replies


ADVERTISEMENT

Immediately Updating Totals Calculated From Subform/query

Aug 6, 2005

I have a problem with a total on my main form (calculated from a subform) not updating immediately. The updated total only displays correctly after I’ve navigated to another record and then back again. I would like the totals to update immediately after I’ve entered the new data. Can anyone help? Here are the specifics…

My main form has a subform which displays a dynaset of records from a query. I’ve set up this subform so that I can enter a new record, which is then written back to the record source for the query. This is accomplished via a combo box from which the user selects a product, and an AfterUpdate event returns the price of that product to the TotalPrice control on the subform. In the footer of this subform is a calculated control (called AdExpenseSubTotal), which calculates the sum of the TotalPrice field from the query. The footer of this form is hidden, and I’ve set up a control on the main (TotalSpent) form which displays the value of the subform control AdExpenseSubTotal. This total seems to update immediately whenever I tab off the relevant field in the subform – so far so good, no problems here.

Now here’s where it gets tricky. My main form has another subform which is hidden. This subform returns a dynaset of records from another query which has the same record source as the query on the first subform. Like the first subform, this subform also has a hidden calculated control with an aggregate function (Sum), and a calculated control (VendorSpent) on the main form to display its value.

As I said before, when a enter a new record in the first (displayed) subform (via the combo box) and tab off it, the TotalSpent control on the main form updates immediately, but the VendorSpent control doesn’t. Obviously the new record I’ve added doesn’t immediately show up in the query dynaset of the second (hidden) subform from which the VendorSpent control on the main form gets its value. The VendorSpent control only displays the updated total when I navigate to the next record, and then navigate back again.

Is there some Event Procedure I need to add to the AfterUpdate property of the combo box on the first subform which immediately forces the second (hidden) subform to requery? I probably haven’t explained myself very clearly, but I can provide a copy of the file (it’s only 184 Kb) if that helps.

View 2 Replies View Related

Queries :: Counting Number Of IDs For Each Week - GroupBy

Oct 22, 2013

I built the below query to count the number of ID's for each week. The problem is that if one month ends mid-week it is counting the next month's IDs in the first month. I need to count the number of IDs within each week by month. I have the first qryGroupbyWeek that assigns a week number to each date then the below query to aggregate.

Code:
SELECT qryGroupbyWeek.Week, qryGroupbyWeek.[Approved Date], qryGroupbyWeek.ID
FROM qryGroupbyWeek
WHERE (((qryGroupbyWeek.[Approved Date]) Between [start] And [end]))
ORDER BY qryGroupbyWeek.ID;

View 2 Replies View Related

Totals Of Calculated Fields In Report Footer

Dec 10, 2014

I have a Report that has calculated fields in the details section. I want to total those fields in the Report Footer. When I run the report I am prompted to enter the value for the calculated fields and the Totals do not appear. Access must be inspecting the report before it actually runs. And so, since the calculated fields do not exist until the report is run then Access doesnt find them during the inspection and hence prompts for input.

View 2 Replies View Related

Reports :: Hourly Rate - Calculated Totals Not Adding Up

Sep 5, 2013

We recently have had a change to our hourly rate that we pay and now the Totals calculation is not adding up the numbers correctly.

In the query that the report is based from:

ExtendedTotal: CCur([Hours]*[Rate])

In the footer of the report: (Provides a Total for each Day)

Sub-Total: "Control Source" is: =Sum(CCur([ExtendedTotal]))

Report Footer: (Provides a Grand Total for the Month)
Total: "Control Source" is: =Sum([ExtendedTotal])

Problem comes in with the odd dollar rate time partial hours. For example:

$9.73 x 4.5 hours = $43.785 (Rounds to $43.79) which is fine...

but when you have a whole column of these rounded numbers, the totals are coming out off by pennies which add up to a good bit at the end of the month. I cannot match up the totals with the invoices that are coming in either.

View 14 Replies View Related

Queries :: Totals In A Select Query

Jul 28, 2014

After you "group by", is there a way to have the next field presented without a sum or avg etc.. if I know there is only ever one value to present?

View 1 Replies View Related

Queries :: Last Function In Totals Query

Apr 26, 2013

I'm trying to build (a rather simple) totals-query, but the "last" function doesn't give me the right values.Suppose I have a database where the amount of products that were sold are stored per month. It's possible that some products are not sold in some months. Now, I want the LAST REAL VALUE (= amount) for each product, no matter what month :

prod1 = 4
prod2 = 3
prod3 = 3

How can I do that, because the LAST-function gives me
prod1 = (empty)
prod2 = 3
prod3 = (empty)

View 6 Replies View Related

Queries :: Summing Query Totals Together

Mar 17, 2014

I have a number of querys which search by month and year, I want to be able to sum up 3 of the querys together and display this in a text box on a form... I have tried dsum etc but I can't seem to do it...

So basically I want the totals which are dsumed into the same form to calculate together in a different query if required... This would be simple except one of the months if from the previous year...

View 2 Replies View Related

Queries :: Running Totals Access Query

Jun 18, 2013

I have a table for timesheet entry for a local building firm. I have a separate table containing employees and rates. I have created query "Qry_ Time Costs" which calculates the cost of hours worked by each employee by multiplying the hours field in the timesheet entry table by the rate field in the employees table.From "Qry_TimeCosts" I have created "Qry_TimeCosts1" in which i have included a running total field for time costs per day using the DSum function.

SELECT Qry_TimeCosts.[Project Title], Qry_TimeCosts.[Build Element], Qry_TimeCosts.[Date Worked], Sum(Qry_TimeCosts.Hours) AS Hours, Sum(Qry_TimeCosts.Cost) AS Cost, DSum("[cost]","qry_timecosts","[project title]='" & [project title] & "'" & "AND [build element] ='" & [build element] & "'" & "AND [date worked] <=#" & [date worked] & "#" & "") AS RunTot
FROM Qry_TimeCosts
GROUP BY Qry_TimeCosts.[Project Title], Qry_TimeCosts.[Build Element], Qry_TimeCosts.[Date Worked], DSum("[cost]","qry_timecosts","[project title]='" & [project title] & "'" & "AND [build element] ='" & [build element] & "'" & "AND [date worked] <=#" & [date worked] & "#" & "")
HAVING (((Qry_TimeCosts.[Build Element]) Is Not Null));

This seems to be working for some projects and not for others. In particular dates 3rd 4th and 5th of June seem to be showing null fields, where all other dates have values. A few projects are showing inaccurate running totals whilst others are working fine.

View 1 Replies View Related

Queries :: Obtaining 3 Separate Totals In One Query?

Jul 22, 2014

I have three tables A, B and C.

I want to build a query that displays three separate totals: Total of A, Total of B and Total of C.

When I try to do this, the query has a weird behaviour summing the totals of the totals of the totals, and I don't know why .

I'm attaching a really basic sample of what's happening, where totals SHOULD be $4, $8 and $16 instead of $16, $32 and $64.

View 14 Replies View Related

Queries :: Apply Conditions To Totals Row In Query

May 15, 2013

I have a parameter query with a totals row that displays averages. Is there a way to have the average row use only specific records in its calculation based on one of the field's values WHILE still displaying all the records returned by the query.I want only data that has a "YES" value used in the average while still displaying the records marked as "NO"

View 1 Replies View Related

Queries :: Formatting Columns In A Query With Totals

Oct 2, 2013

The data within my tables is formatted correctly and when I run a standard query on the data, it comes through the query with the same formatting. However, when I run a query that needs to total the values (whether it's sum or average) the values lose any formatting (and by total I mean the one in design view, not in datasheet view).

I then need to manually format each columns "Format" and "Decimal Places" properties to what I want. I have quite a few queries with quite a few columns, so this is very time consuming. Is there a way to do this faster without VBA? In Excel I can simply highlight multiple columns and format all of them or apply a format painter. I don't see any similar functionality in Access 2010.

View 1 Replies View Related

Queries :: Totals Query Grouped Across Columns

Mar 5, 2015

I have simple table data structured as follows;[Origin], [Code], [Weight]. The Code field is a lookup field that will contain one of 8 choices; 10, 13, 13c, 23, 25, 27, 27a, & other. The other fields are pretty much self explanatory. Sample data would look like this:

Code:
Origin Code Weight
Edison 13 4.25
Edison 13c 2.87
Piscataway 10 5.45
Middlesex 23 1.24
Edison 13 5.21

What I need to create is a totals query where I first group by origin value, then a column for each "code" value which totals the weight for that "code". A sample output would look something like this:

Code:
Origin 10 13 13c 23 25 27 27a other
Edison 9.46 2.87
Piscataway 5.45
Middlesex 1.24

The only way I can think to accomplish this is to restructure the original table to include a field for each code and enter the weight in the appropriate 'code' field. If this is the only solution then Ill have to live with it, but is there any way to create this output using my original structure?

View 1 Replies View Related

Queries :: Totals Query - Return Data Set Between Two Dates

Jun 9, 2015

I am trying to create a Totals Query which returns a data set between two dates. So far I have managed to select the data I want (Please see attached screenshot). However, I only want to select records between a date range working on my field [DueDate]. If I add the due date field to the current query then it removes the grouping and all records are displayed.

View 7 Replies View Related

Queries :: Update Table With Relationship To Totals Query

Oct 21, 2013

I have the following tables:

tblInvoice
tblInvoicePrePayments

They are related with a one-to-many relationship. The related field is "InvoiceId"

I want to create a query that shows selected fields from tblInvoice and the sum of field "PrepaymentValue" from table tblInvoicePrePayments.

I want to be able to edit the fields from tblInvoice in the query.

If I create a totals query (qryInvoicePrePaymentsSum) on tblInvoicePrePayments, using the fields InvoiceId and PrepaymentValue, and then create another query with tblInvoice & qryInvoicePrePaymentsSum, the fields in tblInvoice cannot be updated!

View 3 Replies View Related

Queries :: Query Time Difference AND Monthly Totals

Mar 21, 2013

I am VERY, and I mean VERY new to Access. I've been racking my brain all afternoon and googling like crazy. I just completed two levels of training on Access 2010 and have never worked with the program before. I already set up my tables and now I am on to querying. I have a table with several columns, two of which are "Start Time" and "End Time". I already created a query using the DateDiff function to calculate the time difference for each record. It output a new field with the time difference in hours. Now, I want to sum the totals of the time differences by month and I cannot for the life of me figure it out. My new query has Date (m/dd/yyy) and Hours.

View 14 Replies View Related

Queries :: Removing Grand Totals From Query Pivot Table

Jun 17, 2013

To keep it short and sweet, my query set up is: Employee, Team Name, and then I have the same field in the column as I do in the data and it presents pass/fail data. I have the data shown as a percent of the row so that there is a success rate shown but I want to remove the grand totals from the rows because it is obviously going to be 100% every time and it's unnecessary.

View 13 Replies View Related

Totals Query/sums/grand Totals

Sep 4, 2007

Hey all! This is my first post. Been searching through the net all day trying to find a solution to this problem. Basically i have a table that looks like this (regular text is what i have and bolded text is what I need:Name Date Qty MOBrad 12/12/2007 23323 4423John 12/11/2007 3445 4432 John 12/11/2007 344 4432 John 12/11/2007 45 4432 John 12/11/2007 44 4432 John 12/11/2007 3445 4432 Grand Total: (Qty)And then I'd like to be able to carry this over and display a grand total at the bottom of every page of a report that I would need to generate. Our company produces forms and we sometimes have 60 - 70 people working on a single job. We want to see their hours individually but we would also like to see a grand sum of all their hours. If someone could help with this or needs more info let me know. Thanks for all your help!

View 14 Replies View Related

GroupBy Help Plz

Jan 5, 2007

Hi

I wanna do something similar to what Stephanie.D tried to do before..I read the suggestion she recieved but doesn't seem to work for me. I have one table with the following

==Id==TypeofProd==Name==SpecNameofProd==From==Pric e==

I'd like to create a query that only returns the rows of the table where the Price of the Name is the smallest. Here's an example...
==Id==TypeofProd==Name==SpecNameofProd==From==Pric e==
1 drinks wine Porto Store1 5
2 drinks wine Porto Store2 6
3 food bread Baguette Store3 1
4 food bread Integral Store3 2
5 drinks wine Bordeaux Store3 3
It should return
==Id==TypeofProd==Name==SpecNameofProd==From==Pric e==
3 food bread Baguette Store3 1
5 drinks wine Bordeaux Store3 3

I tried doing a GroupBy but it only works when for the query I only use the SpecNameOfProd and Price fields. I tried using Where like it was suggested to Stephanie but I need the other fields to show...

Thx! for any help and suggestions

View 4 Replies View Related

Queries :: Calculated Field In A Query

Mar 23, 2015

This is not the normal calculated fields in query's. What I want is different, I want it to be like

IFF(ShowID="A",[TotalSales],0)

Thing I have is, I want to know all the Total sales in on row that has Show A in it and then Total sales for Show B. Problem is, I have over 130 shows. How would do that?

View 6 Replies View Related

Queries :: Calculated Date In Query

Jun 4, 2014

I've been struggling with this for a while, and even though I understand the theory, I can't get my code to work correctly.

I have 2 fields:
CallbackFrequency & Last Contacted.

I want to use these fields to populate a third field (callBackOn) so that we can have a list of candidates that need to be called from a certain date.

CallbackFrequency is added from a combobox, so all values are either 1 Month, 3 Months, 6 Months, or 12 Months.

I have tried creating a calculated field directly in the candidates table, but apparently this is not possible.I've therefore tried to create a query using IIF statement that will calculate this value.To get to grips with the code, I'm only dealing with 1 callbackFrequency at the moment. So far I have:

CallbackOn: IIf([Candidates].[CallbackFrequency]="1 Month", [LastContacted],)

I have not factored in the date manipulation yet, as the query does not display the LastContacted date of the record it finds, it only shows a blank cell,

View 8 Replies View Related

Queries :: Calculated Field In A Query

Nov 25, 2013

I Have some calculated fields in a query and want to update it in the table .So,is there anyway to store these fields.Otherwise can i store this Query data every month in database so that when i re-run the query the previous month data will not be affected.

View 1 Replies View Related

GroupBy / Max ? (newbie Alert! :-) )

Dec 29, 2006

I have what is probably a simple question for regular Access users. Before I ask the question, here is a simplified version of the tables involved:


Structure of EMPLOYEE
=====================
EmplID
Name


Structure of TRAINING
=====================
EmplID
CourseID
CourseName
DateTaken


Data in EMPLOYEE
================
EmplID----Name
1234------John Smith
5678------Mike Smith


Data in TRAINING
================
EmplID------CourseID----Course------DateTaken
1234--------NS01--------HeatStreet--06/15/2000
1234--------NS01--------HeatStreet--07/11/2001
1234--------NS01--------HeatStreet--02/07/2002
1234--------NS01--------HeatStreet--08/22/2004
1234--------NS01--------HeatStreet--01/28/2006
1234--------NS27--------Lockout-----01/06/2002
1234--------NS27--------Lockout-----01/27/2004

5678--------NS01--------HeatStreet--12/27/2002
5678--------NS01--------HeatStreet--08/11/2004


Its easy enough to join the two tables in the query and return ALL 9 training records, but I would like to find a way to display only the most recent occurance of each employee taking a course. ie, the max date for each unique EmplID-Name-CourseID-Course combination:

EmplID------Name--------CourseID----Course------DateTaken
1234--------John Smith--NS01--------HeatStreet--01/28/2006
1234--------John Smith--NS27--------Lockout-----01/27/2004
5678--------Mike Smith--NS01--------HeatStreet--08/11/2004

I thought maybe "GroupBy" on EmplID, Name, CourseID and Course and "Max" on DateTaken would do the trick, but apparently not. Is there a way to do this without code?

Thanks in advance........ :)
-SD

View 5 Replies View Related

Queries :: Calculated Date Field In Query

Sep 10, 2014

I am having a problem with calculating a date field in a query. Prior to this posting I've done some research and made several changes to my query. This only resulted in fixing one problem but then creating another problem. Original problem was I had 2 fields, arrived (23:36) and stemi (0:07). I use the following calculation AT_ST: DateDiff("n",[arrived],[stemi]) which resulted in -1409. So my research showed me I had a problem with the date whenever the time went past midnight and trying to calculate a zero hour number. I changed my calculation to

AT_ST: IIf([stemi]>=#11:59:00 PM#,(DateDiff("n",[arrived],[stemi])),(DateDiff("n",[arrived],[stemi]+1440) Mod 1440))

This works fine and gives me the result of 31 minutes which is what I want, however the problems comes in when I change to this calculation any where there was a negative time now has a 1400+ plus value. Such as arrived (7:37) and 1st_eck (7:18) = 1426 where as before it would report -14 (yes, negatives are acceptable for my reporting because sometimes a call to the hospital is placed before the patient arrives so we want to report on the negative splits). I've tried using a nested IIF to calculate for stemi time being less than arrived time, this didn't work when I tried to use it on the calculated query field. I was wondering if I could write something to check the value of the calculated field if it is greater than 1440 and if yes - subtract 1440 from it. So in the example above 1426-1440 = -14. Is it possible to do this within the query or do I need to do it using VBA

View 14 Replies View Related

Queries :: Filter Calculated Query Field

Nov 13, 2014

So I have the following query field which calculates another field.

How do I Filter the records in this calculated field to only return TRUE, as if I put "TRUE" in the Criteria for this field (or anything at all) then a parameter message box pops up asking for [Balance].

Code:
Balance1: IIf([Balance]<>0,"TRUE","FALSE")

View 8 Replies View Related

Queries :: Selecting A New Calculated Field In Same Query

Aug 30, 2013

I want to calculate a field that is Sales*6+Salary, then in that same query I want to select ONLY the greatest Salary per employee. So for example

SELECT EmpId, MonthDate, Sales, Salary, [Sales]*6+[Salary] AS SalTot
FROM EmpTable S1
WHERE SalTot = (SELECT MAX(SalTot) FROM EmpTable S2 WHERE S1.EmpId = S2.EmpId);

Can I not select a value that has been calculated this query?

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved