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 Replies


ADVERTISEMENT

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

Queries :: Count Total Number Of Records

Dec 18, 2013

I am wanting to display in a text box or on my report the total number or records in my database. Also I have some buttons that filter the results a little, I'm wanting to display the number after I hit the button(s). Would I just add the query to the end of each button I have?

View 6 Replies View Related

Queries :: Number Of Columns In Two Selected Tables Of Union Query Do Not Match

Dec 9, 2013

I'm new to Access. We have a database that was created years ago and has been working fine. Now suddendly we get the following error message on a query.

"The number of columns in the two selected tables or queries of a union query do not match"

This is the code

SELECT [TimeSheets All].[Job Number], [TimeSheets All].Date, [TimeSheets All].Details, [TimeSheets All].[Start Time], [TimeSheets All].[End Time], [TimeSheets All].[Unbillable hours], [TimeSheets All].Who, *
FROM [TimeSheets All]
WHERE ((([TimeSheets All].[Job Number]) Like [Forms]![Search]![Job Number]))
ORDER BY [TimeSheets All].[Job Number], [TimeSheets All].Date;

View 3 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

Queries :: Combining Like Records In Union Query

Nov 25, 2013

How can I add the resulting records from a union query. The results of the union are something like this:

Quantity Item

2 Cats
3 Cats
1 Dog
4 Mice

What I need to display is

Quantity Item

5 Cats
1 Dog
4 Mice

How can I get the query to "do the math"?

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

Queries :: Union Query - Multiple Records On One Report

May 7, 2014

I have a database that has over 20 tables in it and am using Access 2000. Unfortunately I cannot change the structure as it performs specific functions, so I am stuck with it.

I have created a Union Query from these tables yaking data from 5 fields using the Serial Number entered by the user.

SELECT[Workstation].UnitPart,PropertyTag,UnitSerial,Date,Technician
FROM[Workstation]
WHERE((([Workstation].UnitSerial)=[Enter Serial No.];
UNION
SELECT[LAPTOP].UnitPart,PropertyTag,UnitSerial,Date,Technician

[Code] ....

I use a bar code scanner to scan the serial number, and it goes through the tables and returns the results along with the other specified fields.

I would like to scan up to 16 or more different serial numbers and have it return the results. Perhaps scan the first 16 serial numbers, then run the query? Is that possible. The serial numbers are unique and will return a combination of laptops, printers, monitors, etc...

I have created a report from the above union query and it works perfectly with only one serial number entered.

View 14 Replies View Related

Queries :: Calculate Total Number Of Days Between Two Dates In A Query

Feb 18, 2015

Basically I have a report that shows any 'Issues' that wasnt closed within the KPI Target.

I have the report working, but I simply want to do a count of how many days the observations overran the 'Target Date of Closure'.

The report also shows observations that are not closed but passed their Target Date of Closure. These observations will not have a 'Actual Closure Date', but I would like to still have a count of how many days its overrun closure.

This is a formula I tried to piece together but obviously not correct as it's not returning anything;

IIf(IsNull([Issues]![Actual Closure Date]),DateDiff("d",[Issues]![Target Date of Closure],
Date()),DateDiff("d",[Issues]![Target Date of Closure],[Issues]![Actual Closure Date]))

View 2 Replies View Related

Queries :: Counting Total Number Of Returned Results From Query?

Aug 11, 2015

I'm trying to run a line of code after doing a Query Search that reports back the total number of results pulled from the search. I've dug around and found some useful code, but nothing that gives the results I'm needing. Most everything gives me the total number from the query. I'm also using a Split Form.

The process goes: Enter numeric search in Text10 and hit the search button to run the following macro: [studentID]=[Forms]![Query1]![Text10]

It then gives me the requested information.I have a second text box (Text19) that needs to display the number of pulled results. I've written VBA that only gives me the total number searched for studentID or for the entire Query.

Can I simply add an additional line to the Macro?

View 7 Replies View Related

Queries :: UNION / UNION ALL Query Crashed Access

Oct 24, 2013

I'm having a problem with a UNION / UNION ALL query.It seems there is a application crash fault when running the query that MS are aware of and have issued a hot fix. Unfortunately it will take my IT dept some time to check and install the hot fix If they agree to do it at all.

Problem signature:
Problem Event Name: APPCRASH
Application Name: MSACCESS.EXE
Application Version: 12.0.6606.1000

[code]...

View 1 Replies View Related

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 8 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

Total Number Of Records

Apr 17, 2006

I want to run a query to add up the total number of records in a table.

i have looked at the Microsoft help but that tells me how to add together the totals of the fields but not the total of fields

any ideas?

Thanks

View 5 Replies View Related

Modules & VBA :: Calculating Number Of Days Between Records

Sep 10, 2013

I am trying to calculate the number of days between incidents.

If I have an incident that happened on the 10th August and another on the 15th August then this would be 5 days, the next incident occurred on the 28th August so that would be 13 days. The problem I am having is how to get access to use the latest date rather than the first date.

View 14 Replies View Related

Display Total Number Of Records On A Report

Oct 26, 2004

I'm sure this is a no brainer for those in the know - but I dont!
So how do I display the total number of records at the end of a report?

View 14 Replies View Related

Forms :: Show Number Of Total Records In Subform?

Feb 15, 2014

I have a continuous subform. Because the records are often many, the user needs to scroll down the page.

How do I have a text box in each row that shows Record x of Total Records?

I tried setting a text box control source = [currentrecord] in the Detail area of the subform but it didn't work . It did weird things because I suspect the control is trying to show the record that has the focus or something

View 1 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

Forms :: Text Box On Form To Show Total Number Of Records

Jan 28, 2014

I have a form containing 4 text Boxes txt1, txt2, txt3 and txt4

I want

txt1 show records from table empDetail having age between 18 to 25
txt2 show records from table empDetail having age between 26 to 35
txt3 show records from table empDetail having age between 36 to 45
txt4 show records from table empDetail having age between 46 to 55

View 3 Replies View Related

Forms :: DCount Function In Subform - Total Number Of Records

Jun 14, 2015

I am trying to count the number of records in a subform where the text box (txtFinal) = RPR-RPR & RTN. The subform is called PartNumbers. The table name the subform is bound to is named Completed.

I tried using =DCount("[Part Number]","Completed","[Final] = 'RPR-RPR & RTN'"). That is counting the total number of records in the table, not the total number of records in the subform. How do I get it to count the total number of records in the subform?

View 10 Replies View Related

Queries :: Number Of Hours - Calculating Difference Between Times

Jun 23, 2014

I am starting to create a resourcing database that needs to be able to work with dates and times and perform calculations on them.

I need to work out the number of hours. I have two date/time fields Day_Start_Time and Day_End_Time. I want to calculate the difference between the two in hours and then multiply by the number of working days.

I tried this: Number_Of_Hours: DateDiff("hh",[Day_Start_Time],[Day_End_Time])*[Number_of_days]

But get #Func! when I run the query.

View 3 Replies View Related

Queries :: Query To Count Number Of Different Records?

May 28, 2014

If I have a table called "Calls" with an autonumber and another field with names for stores like this:

1 Hobby Mart
2 Peter's Store
3 Hobby lobby
4 Hobby Mart
5 Peter's Store

How can I build a query to count the number of different store names?

For example, in this case I need the query to return the number 3.

View 7 Replies View Related

Queries :: Query To Display Number Of Records Per Value

Aug 9, 2013

I have a date field in a table. I wish to display in a query:Column A representing the month. Column B representing the number of records in the table corresponding to that month.

View 5 Replies View Related

Queries :: Counting Number Of Machines In Department And Total Migrated

Nov 7, 2013

I have an access dbase with a single table

I am interested in reporting so need totals, I can write a query that will count the number of machines in a dept like so

SELECT [Computer Inventory].Department, Count([Computer Inventory].ID) AS CountOfID
FROM [Computer Inventory]
GROUP BY [Computer Inventory].Department;

This works fine, however I now want to add more so are two fields

To_be_migrated
Is_migrated

These are just checkboxes so I assume criteria is true or false

I need a query which will give me

The total number of machines by dept
The total marked for migration
The total migrated

View 4 Replies View Related

Queries :: DISTINCT COUNT Of Name If Total Number Of Items Greater Than 0

Jan 29, 2014

I have 2 tables linked with a 1 to many relationship by NAME. Tables look like this....

TBL-STORE

NAME ADDRESS
Walmart 12 Nowhere
Target 14 Somewhere
Lowes 10 Anywhere
Sears 16 Nowhere

TBL-PURCHASES

NAME [NUMBER OF ITEMS] [PURCHASE DATE]
Walmart 4 1/4/14
Walmart 2 1/5/14
Target 0 1/5/14
Lowes 3 1/5/14
Sears 1 1/5/14
Sears -1 (returned to store) 1/6/14

I want a DISTINCT COUNT of [NAME] if Total[NUMBER OF ITEMS]>0, so the correct number will be 2 in the example.

This is one way I've tried to write the SQL, but I keep getting an error...

SELECT Count([TBL-STORE].[NAME])
FROM [TBL-STORE] INNER JOIN [TBL-PURCHASES] ON [TBL-STORE].[NAME] = [TBL-PURCHASES].[NAME]
WHERE ([TBL-PURCHASES].[NUMBER OF ITEMS]>1)
HAVING ([TBL-STORE].[NAME])="DISTINCT");

I also tried an Count(IiF( and can't get that to work either..

View 3 Replies View Related

Queries :: Crosstab Query - Counting Number Of Records For Each FY

Sep 19, 2013

I have been tasked to create a DB for my unit. I have created a few DB, but I am a novice at best. I need a crosstab Query to count the number of records for each FY. The Army's FY is from Oct -Sep. I only need to show the the total number of record for the previous FY in a Report and on a form.

View 7 Replies View Related







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