Need Help With Calculating Total Row In Query

Aug 19, 2007

I quess it should be simple. But I couldn't find an answer or example in Access books and online.
I have an access 2000 database with a Accounts Receivable table. I am building a query that returns accounts what are 60 days past due and calculating total ballance of ONLY past 60 days accounts. I managed to write a code to display 60 days past due acounts, but when I use UNION query, it calculates total from entire Accounts Receivable table, but I need only total ballance of past due accounts.

Here is my SQL code

SELECT [Accounts Receivable].InvoiceID, [Accounts Receivable].[Patient Last Name], [Accounts Receivable].[Patient#], [Accounts Receivable].InvoiceDate, [Accounts Receivable].PaymentAmount
FROM [Accounts Receivable]
WHERE ((([Accounts Receivable].InvoiceDate)<Date()-60))
UNION SELECT 'TOTAL', "","","",Sum([Accounts Receivable].PaymentAmount)
FROM [Accounts Receivable];

I need my query to look like this.

InvoiceID Patient Last Name Invoice Date Payment Amount

23 Smith 05/01/2007 $100
25 Doe 04/03/2007 $200
Total - - $300

Please help.

View Replies


ADVERTISEMENT

Queries :: Calculating Total Number Of Records From Union Query

Jun 16, 2014

I am using the following UNION QUERY to total up equipment tested for a report.

SELECT "Laptops Tested" AS PCEQUIP, Count(*) AS RECORDS
FROM [LAPTOPS]
WHERE (((Date)Between [Enter Start Date] AND [Enter End Date]));
UNION
SELECT "Workstations Tested" AS PCEQUIP, Count(*) AS RECORDS
FROM [WORKSTATION]

[code]...

I have created a report using ACCESS 2000 for this union query and it satisfies the requirement. I am trying to add the proper code and syntax in this query to total the number of all of this equipment tested.In this case the total would be 86. Is this possible?

View 2 Replies View Related

Queries :: Running Total Query Not Calculating First Fiscal Year

Aug 5, 2014

I am trying to create a running total query that aggregates project funding by fiscal year. The fiscal year is calculated based on a date time field that is never null. The totals field comes from 2 different number fields that are either 0 or > 0. The query is going to be linked to by Excel, so I have to do the running total in the query itself, vs. a report.It is close to working, except that it is not totalling the first fiscal year. The output surrently looks like this:

FYear BudgetedCostIndCont Commitment
2010
2011 8585643 4742000 3843643
2012 2297116511432165 11539000
2013 3618726216963282 19223980
2014 4457769020706644 23871046
2015 4963815023206644 26431506

As you can see, the first row for FY 2010 is blank. I know there is data there, as this query is fed by a subquery that selects these rows based on contract signed date. Below is the SQL of each query:

Code:
SELECT Year([DateContractSigned])-IIf([DateContractSigned]<DateSerial(Year([DateContractSigned]),4,1),1,0)+1
AS FYearExport
FROM tblProject
GROUP BY Year([DateContractSigned])-IIf([DateContractSigned]<DateSerial(Year([DateContractSigned]),4,1),1,0)+1, tblProject.ProjID, tblProject.FPAccepted
HAVING (((tblProject.FPAccepted)=True));

and the Aggregate query:

Code:
SELECT qryDashboardChart1.FYearExport,
DSum("[BudgetedCost]","tblProject","Year([DateContractSigned])<=" & [FyearExport]-1 & "")
AS RunTotBudgetedCost, ([RunTotBudgetedCost]-[RunTotTECTERRACommitment])

[code]....

I should also mention that I cannot implement the NZ() function, as Excel balks at this when trying to link to Access queries.

View 8 Replies View Related

Calculating Total From A Subform

Oct 26, 2005

Hi,
Attached is a project I'm working on. We want to calculate the total delays on each day. In a form called 'main' there is a subform for the delays on that date. But the 'Total Delays' control does not work.
I have used the following format to get the total from the subform:
=Delays.Forms!TotalDelay
'TotalDelay' is the name of the control which calculates the total of the delays within the subform.
I have used the =[Delays].[Forms]![TotalDelay] format in other projects and it works. However in this program when I want to save the form, the control source is changed to :=Delays.Forms!TotalDelay (the brackets are removed)
Thank you

View 1 Replies View Related

Calculating Total In A Subform

Sep 17, 2004

I have a Main form with a sub form. Every record in the main form has multiple sub form records. (they are linked in a one to many relationship)

Each subform record has a "price" text box. I would like a total of all the "price" text boxes for that main record to be displayed in the main form.

It needs to be updated when a new subform record is added or changed.

Any help is welcomed. Thanks in advance
Joe

View 7 Replies View Related

Calculating Total Cost

Dec 7, 2004

I am currently making a database project for a school assignment.

I have based the project idea on a local hotel, which consits of a diffrent price dependant on the date booked.

So i have set up a table called "prices" which consits of the following fields:

PriceID
RoomID *
Price
Start Date
End Date

the RoomID is the foreign key, as it is linked (one-to-many) with my Room's table, which consists of the following fields:

RoomID *
Room Number
.. (unecessary fields for the problem)

The room ID is also linked to the bookings table (again one-to-many) with the bookings table consisting of:

BookingID
CustomerID
RoomID
Start Date
End Date
... (uneccessary fields)


what i am hoping to do is (i assume) make a query that will calculate the cost the customer has to pay. So it will look at the start and end date booked in the bookings table and comapre it to the dates in prices table, and find out the cost from this....

any help on going about this would be greatly appreciated, and i hope i have supplied sufficient information (i'll try attach a graphical image of the relationships if that is helpful?)

thanks

michael

View 2 Replies View Related

Calculating Records Total

Jan 3, 2005

hiYA everyone!
in my report footer, i want a number of records displayed
in the report. how do i do that? my report is based on a query.

View 1 Replies View Related

Calculating Total Costs From 2 Different Fields

Dec 21, 2005

I have a table with products and their costs per unit of measure.

some products are costed by weight and others by piece.

table looks something like this:

product
pcs
weight
unit of measure (EA or KGS)
cost

Query should look like this:

product
pcs
weight
Total Cost

Is it possible to write an expression that, depending on the unit of measure uses the pcs or weight field to calculate the total cost ??????

View 5 Replies View Related

Calculating Fiscal Year Total

Nov 4, 2004

I need to provide a report on data over a fiscal year that has the following format:

apr 03
may 03
jun 03
q1 total
jul 03
aug 03
sep 03
q2 total
oct 03
nov 03
dec 03
q3 total
jan 04
feb 04
mar 04
q4 total
year total

I can group by quarter and sum() in the group footer which works, but when I group by year I get totals for 03 and 04 separately. I have also tried sum() and dsum() in the page footer, which gives #error, and vba in page footer:

Dim pageTotal As Long
Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
' Add to Page Total
pageTotal = pageTotal + Me![ClientsServed]
End Sub
Sub PageFooter_Print(Cancel As Integer, PrintCount As Integer)
' Show Page Total Price
Me![yrClientsServed] = pageTotal
End Sub

which calculates properly in the detail section (var watching "pageTotal") but outputs nothing in the footer, though the name of the text box in the footer is correct.
If anyone can see an error in what I'm doing or suggest another approach, I would really appreciate it, this is driving me nuts.

View 1 Replies View Related

Tables :: Calculating Columns Total

Jul 18, 2015

I have a personal expenditure data base indicating daily expenditure on various heads ( File Attached). I want table to reflect expenditure on various heads on daily basis in COLTOT column. Any subsequent change in any of the field to be dynamically updated.Presently I am exporting file to excel and calculating the total there and then manually updating the COLTOT field. Other alternative I tried was to create a form and make a text field and sum the fields using formula like =nz([milk])+nz([vegetables]). I feel it may be unwieldy for such large number of expenditure heads.

View 14 Replies View Related

Calculating Total Time Worked

Sep 11, 2014

I have a table in access that has 1 ) persons ID and ) log date/time 3) direction in or out

I need to calculate the amount of time spent by the person in the office. e.g User with ID 1 will come in at 8 in the morning and go out after an hour then come in again and go out. Till he leaves out for the day. I need to find the first time he came in and last time he went out and find the difference for the hours he worked

The data is in Device logs table.

View 3 Replies View Related

Calculating Total Prices Only For Specific Records

Mar 22, 2008

Look at this query:

http://i237.photobucket.com/albums/ff304/hankymskdghdfag/qryUvoz.jpg

I wan't to calculate the price totals but for each instance of Uvoz ID separately. I've sucessfully used Dsum function but I managed only to calculate all price totals for all instances of Uvoz ID. Is it possible to do it for each number of Uvoz ID separately? How do I do it?

View 9 Replies View Related

Calculating Employee Overtime Worked (weekly Total)

Oct 26, 2006

Hello my beautiful worldwide friends :D
I am trying to calculate employee Overtime hours from their recorded TimeIn and TimeOut if over 7.5 hours. So anyday they work past 7.5 hours should be calculated and totalled at the end of the week. And i can't seem to figure it out, maybe my maths is bad? Maybe it's my query? The section of my report? What could i be doing wrong here, i have spent hours and im getting no where.

I have attached my report.
Can you help me figure out why my daily total shows but the weekly total is not showing?

View 9 Replies View Related

Queries :: Time Sheet / Payroll Database - Calculating Total Daily Hours

Feb 18, 2014

Access Query. I am creating a time sheet / pay roll database and I want to be able to get a total of the daily hours in a query.

For example I have 'Mon Start' and 'Mon Finish' for Mondays in/out times and I have a 'Mon Total' which gives me the total hours worked for Monday.

The problem I have is that Mon Total only works if the hours are say between 07:00 and 17:00, anything after midnight (00:00) like 21:00 to 07:00 and 'Mon Total' goes crazy !!

At the moment 'Mon Total' is the result of CDate 'Mon Finish' - 'Mon Start' (bit rough I know).

View 3 Replies View Related

Queries :: Self-Referencing Running Total Used To Calculate Next Total In A Query

Jul 23, 2015

I am trying to create a query that has a self referencing running total based on the values (point totals) of itself (running total of values in the running total column that have already been calculated for all previous records) plus the total of new points being added in the current record, less the total of points being removed in the current record. This running total can never go below 0, if it does, the running total should restart at zero and add in only new points and begin the process again with the next records

I am able to do this in Excel in less than two seconds so I know there has to be a way to port this into a query. I've attached an excel example of what I am exactly trying to do

If it takes multiple queries to complete the required output I am ok with it. In my previous outtakes I have had up to 8 queries but just couldn't seem to do it..

View 9 Replies View Related

Tables :: Calculated Fields As Data Type In Tables - Calculating Total?

Apr 23, 2013

I am using calculated field as a data type in access 2010.

They are working fine.

However, I added a new field and now the final calc won't work.

I have Subtotal adding loads of fields together. Works fine.

Then I have a VATunit field which is a double integer, so enter 20 and my next field is VATTotal calculates the SubTotal + the VATunit by doing (Subtotal/100)*VATunit. This calculation is fine and gives me the correct amount.

The next field is a Total field. Which adds Subtotal and the VATTotal together. Howver, the Total is the same as Subtotal. It is not adding the VATTotal to it?

View 2 Replies View Related

Calculating Total Time But Excluding Overlapping Time

Aug 22, 2012

I have a database consisting of two tables. One is "articles" and the other is "tasks". To put it simply, I would like to find how much time the article spends in tasks, but one article can have many tasks, and they often (but not always) overlap. Tasks have a start and end date field.

View 8 Replies View Related

Total Daily Sales Queries By Model/Total

Mar 8, 2008

Hi,

1) I am pretty newbie to this access programming, do forgive me if my questions sounds stupid.

2) Basically I create an application in access capturing or production information for my company. now the top management suddenly wanted whats their main concern:- Total Daily/Monthly, Quarterly, Annual Sales (By Model If possible)

3) I start with daily (Lets don't be too overly ambitious).

4) I try to let user select dates from my calender control and reflect daily sales (in Total & By Model break down) insert into my form.

5) Understand someone told me from my previous post in Calender control I can achieve it either through forms or queries, which is a better way. (in terms of flexibility to change for program maintenance/ scalibility) wise ?

PS: Please forgive my ignorance :o:(

Thanks (In advance) & God Bless.

View 2 Replies View Related

Calculating In A Query

May 25, 2007

Is it possible to use the result from a calculation in a query as data for a field in the table the query is based on?

Basically, I have an event that has a start date and an end date. The table stores individual events and the query only shows those events that have a start date but nio end date.

Also, each event can restart later with a new start date and end date.

I want to use the dates to calculate the number of days duration for the event's instance and store that in the table for later use - each event is allowed only a certain number of days.

Then, I'll need to add up the number of days for each instance of an event, to see if it has reached the maximum allowed.

So, like this;

Table Fields:
eventID, eventtype, startdate, enddate, numdays

As soon as I enter an end date for an event, I want it to calculate the number of days since the start and put that in the numdays field.

Then, I'll need to add up all the numdays for each eventtype.

The part I'm really having trouble with, though, is just the part to do a calculation and put the answer in the table that the query is based on.

In the event builder I tried [numdays] = [enddate] - [startdate], but it always drops the numdays part, leaving me with = [enddate] - [startdate].

Any ideas?

View 2 Replies View Related

Calculating Query Help

Nov 3, 2004

Here's what I have. Three tables: data, EntityCurrency, and Rate. data and EntityCurrency has a 1 to many relation ship by vendor number(1 on entityCurrency and many to data). EntityCurrency has an intermediate relationship to Rate by Currency. I need to be able to take a field in data(field = amount) and devide it by a field in Rate(field = rate). Here's what I have come up with and it doesn't work. I tried this expression as one of the fields: Expr1: [Sheet1]![Amount]/[Rate]![Rate] and it gives me an error: You tried to excute a query that does not included the specified expression 'Sheet1!Amount/[Rate]![Rate]' as part of an aggregate function. I was just wondering anyone could help me with this.

View 1 Replies View Related

Calculating Totals In Query?

Aug 22, 2012

I'm trying to build some queries with calculations in, and I'm not able to do what I had hoped. Am I doing it wrong?

This is about sales.I'd like to firstly, be able to have a quick query, to see how many items a seller listed, with total price (this seems fine, if I count the item IDs, and sum hammer price in a query).And vice versa, by buyers.But, I'd like to sum for sellers, number of items Sold, Returned or Relisted.

I have a status (blank for active, "sold, "relisted" or "returned", and thought, I could "count", by the status = "Sold" (ie), but it won't accept the expression.

for sellers, I had hoped to have one query, with total items listed, total money made, then totals for still active, sold, returned and relisted items.

Am sure I'm doing something basic wrong, but I can't think what.

View 2 Replies View Related

Calculating Value From Non-related Query And Table

Aug 30, 2007

Hi, I'm a total newbie at Access, and know nothing about scripts. I've been operating at the level of using the Wizards and drop-down menus. I am trying to create a report that does two things:
1. Displays the results of queries that sum data from a table (I think I have this figured) and
2. Displays those sums as a percentage of a number that is input each time the report is run. (This is only one number that comes from a totally different place and has no prior relation to the data.)
Any help/advice that anyone could offer would be much appreciated!
Thanks!

View 5 Replies View Related

Query Help, Calculating Multiple Fields.

Jul 30, 2007

I've imported an Excel file into a table and now I've created a Query from it.
I now need to Add Fields (names are not in the table) and calculate totals for these renamed fields some of the answers are going to be the result of two or three fields.
Any help would be greatly appreciated.
thanks

View 8 Replies View Related

Calculating Date Difference In Query Or Sql

Jul 29, 2014

I'm trying to work out the difference between 2 records both of which have a call out date [bas start date]..basically the structure is

equipment number call number bas start date
12345678 112255 1/7/14
12345678 112256 3/7/14

What i'm after is the 4th column to work out the date diff... in this case 2 days the equipment can be multiple times so i might see equipment number 12345678 - upto 10 times with consecutive dates - all of which i need to know the difference between the current call date and the previous call date..

View 3 Replies View Related

Sub Total Query

Aug 5, 2005

O.K, I am really trying to figure this out from other postings but my limited query experience is limting my understanding of the other posts.

I only know how to use the query wiz and then a bit in design mode.

I have a Query

[ID]pk [Contest Name], [Score]

There will be many records for the same [Contest Name] in the underlying table. Therefore i want to sub total by [Contest Name] so i can then create a report. I have created the report perfectly using the Report support in another posting submitted. But the report does not allow me to order the results as the sum calc is a function on the report. Therefore I am now exploring the Query Sum [Score] order by [Contest Name].

I just need it in a Qery for dummies format.

Go into design mode and put the following in what portion of the query on what line.

I will keep on searching in the mean time

View 1 Replies View Related

Sum Total In A Query

Oct 10, 2005

I have a query which returns charge_cost (based on course cost, whether it went ahead, if hospitals are eligible for charging etc) which is then used in an existing report.

I want to make another report which simply is:

Total training spend for 2004-2005:
£1276.04

And i just want that to be the SUM of charge_cost.

I cant work out how to do this - i did a new query including charge_cost and then created a new field called total_spend: sum([charge_cost]) but i keep getting the message "You tried to execute a query which does not include the specified expression charge_cost as part of an aggregate function"

I have no idea what this means...

View 2 Replies View Related







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