Queries :: How To Sum Field Based On Every Year

Jul 2, 2015

I tried writing a SQL query to produce the list of details in year wise DESCENDING order for the input - Agent ID.

In addition to that I need to get the sum of amount fields year wise in the report. How to achieve it???.

Find the attached report for better clarification.

First three column in the attachment is the outcome of the below listed query. Whereas the fourth column is the expected result which needs to be included..

Code:
SELECT CessioneCredito.Data_Movimento, CessioneCredito.Anno, CessioneCredito.Importo FROM CessioneCredito
WHERE (((CessioneCredito.ID_Agente)=[Reports]![R_StoricoCessCredAg]![ID_Agente]))
ORDER BY CessioneCredito.Data_Movimento DESC;

How to alter the code in order to provide the SUM of Importo field every year.???

View Replies


ADVERTISEMENT

Queries :: End Of Year Age Based On A Date

May 15, 2014

I have a date of service [DOS] and a date of birth [Birth Date]

I'm trying to calculate the age at the last day of the date of service year not the current year.

Example:
[Birth Date] = 6/25/1993
[DOS] = 10/18/2013
Age at the last day of the date of service year (12/31/2013) = 20

How to do this. I tried

Code:
DateDiff("yyyy",[BIRTH DATE],[DOS])+Int(Format([DOS],"mmdd")<Format([BIRTH DATE],"mmdd"))

but this does not work correctly.

View 8 Replies View Related

Calculated Field Based On Accounting Year

Feb 8, 2006

Within a query i am trying to run historical pension values based on 3 fields from a table:

Value
Year
Period

Period: Is aligned with the accounting year April to March rather than Jan to Dec. So I cannot define Year as 2005 and period 1 to 12.

I am looking to define year as 2005/2006 and then calculated the sum of period 1 to 12.

Has anyone experienced this before and found a solution?

Thanks

View 2 Replies View Related

Queries :: How To Set Rolling Year Based On Individual First Record

Mar 31, 2014

I wanted to know if it is possible to set a rolling year based on the first recorded date for an individual. In other words, my table is updated every time an employee receives a point. The record includes the employee's name (empName), the date (dateOfOccurrence), and the point (occurrencePoint).

I would like to create a query that would be based on a rolling year from the very first record of an employee based on the first dateOfOccurrence. The first date/record of this employee would be the start of the rolling year. I am writing this in SQL in Access 2013.

View 1 Replies View Related

Queries :: Calculate New Fields Based On Current And Prior Year-end Numbers

May 6, 2013

I am creating a Make Table Query and calculating new fields based on current and prior year-end numbers. If the prior year-end number does not exist (Is Null), I want the use the current rate or calculate the change in rate. I have typed the below in the Field Box:

CHG_IN_PGM_RATE: IIf(([P0_10 Tbl - AM PYE PTD Detail w Rates]![PTD_PYE_PGM_RATE]) Is Null,([MASTER LIST CURRENT]![PTD_PM_PGM_RATE]),(([MASTER LIST CURRENT]![PTD_PM_PGM_RATE])-([P0_10 Tbl - AM PYE PTD Detail w Rates]![PTD_PYE_PGM_RATE])))

However, when running the query, I get the attached error message.

The screenshot will also show how the two tables are joined.

View 2 Replies View Related

Forms :: Change Datasource Of Form Field Based On Current Year

Nov 12, 2014

I have a little "y2k issue".

My DB has many (!) forms that are based on Crosstabs queries. The headers are years, and therefore my formfields has controlsources like 2014, 2015 and so on.

Example:

The table it comes from looks something like this:

tblProject
Project: Myproject
Value: 1000
EndYear: 2014

The crosstab then takes the EndYear as a coloumn header. Then my forms use these fields, now named 2014, 2015, 2016 .... and give me a nice looking table showing the accumulated "end" for multiple projects.

The problem is when the year changes after 31/12, all fields must manually be changed. This means I have to manually change 2014 to 2015, 2015 to 2016 and so on in all of my formsfields controllsource.

I have played around to find a way to change the source of the field, and hoped I could say something like =year(now()) and for the next year say =year(now())+1 but this only returns that year as a value, and not as a controlsource...

The query functions nicely (ive changed the system time, and it has no issues with this structure), but the forms source is still in the previous year, and returns and error (of course).

When the year changes past new years eve, so will the headers (fieldname) change... but how to make the form change fieldsource?

View 3 Replies View Related

Queries :: Sort Out Invoices By Year - Query Based On Combo Box To Show All Records

Mar 4, 2015

I am trying to have a query sort out my invoices by year but also to have the possibility to show all invoices.

I have one table "INVOICE" where I have a column "YEAR" calculated with DatePart function from the invoice date.

On my form "INVOICE LISTING", I want to have a combox "Combo957" selecting the year. I have forced the "ALL" selection to the combox using a UnionQuery.

My problem, I cannot get the query to work. I have tried many ways, the closest I can get is :

IIf([Forms]![Invoice Listing]![Combo957]="ALL",([Invoice].[Year])<Year(Date()),[Forms]![Invoice Listing]![Combo957])

If I select the year from the combo, it works, if I select "ALL" nothing is shown.

here is the full SQL

SELECT DISTINCTROW Companies.Company, Companies.City, Companies.Country, Sales.Brand, Sales.Type, Sales.Date, Sales.QuoteNo, Sales.Delivered, Sales.Account, Sales.Branch, Invoice.InvoiceNumber, Invoice.InvoiceDate, Invoice.CustOrderNumber, Invoice.PaymentTerms, Invoice.DueDate, Invoice.NetAmount, Invoice.TotalAmount, Invoice.Tax, Invoice.PaiementRCVD, Invoice.Overdue, Invoice.Month, Year([Invoice]![DueDate]) AS DueYear, [Invoice]![month] & " - " & [Invoice]![Year] AS InvoiceMonth

[Code] .....

View 5 Replies View Related

Queries :: Grab Custom Fiscal Year Count Based On System Clock Date

Aug 13, 2015

How do you grab a custom Fiscal Year's values based on the system clock's date?

I am building a query where I want to see the number of closed cases based on the current custom fiscal year with the system clocks date. The report that it feeds only cares about the current FY.

I need the System Clock's FY value in this query

Code:
SELECT shortname AS Station, NZ(TotalCount.TotalCases,0) AS [Cases Complete]
FROM StationList LEFT JOIN (SELECT station, count([Open Issues].ID) AS TotalCases FROM [Open Issues] WHERE [Status]="Closed" GROUP BY Station) AS TotalCount ON StationList.shortname =TotalCount.station;

Within the Query Open Issues I have the FY broken up

Code:
fiscalYear: IIf(Month([Issues].[Opened Date])>=10,"FY" & Year(DateAdd("yyyy",1,[Issues].[Opened Date])),"FY" & Year([Issues].[Opened Date]))

View 4 Replies View Related

Queries :: How To Add One Year Onto Date Field

Jan 9, 2014

I want to add one year onto a date, I could do this in a query or just add it on on a textbox in the form?

Field Name is IncidentDate from table tbl_incidents

View 4 Replies View Related

Queries :: Matching Year Field In 1 Query

Feb 5, 2015

Using Access 07

This is my query

SELECT QrySiteAlloc.Site, QrySiteAlloc.AllocYr, QrySiteAlloc.SiteAllocation, Sum(QryReserveTotals.SumOfAddtlAllocationAmt) AS SumOfSumOfAddtlAllocationAmt
FROM QrySiteAlloc LEFT JOIN QryReserveTotals ON QrySiteAlloc.Site = QryReserveTotals.Site
GROUP BY QrySiteAlloc.Site, QrySiteAlloc.AllocYr, QrySiteAlloc.SiteAllocation;

In the QryReserveTotals is a datereceived field.

I need the year of the date received field to match the QrySiteAlloc.AllocYr that will be selected by a parameter..

what would be the criteria to achieve this?

View 3 Replies View Related

Queries :: Compute Year Growth For A Field

Jun 2, 2014

I need to compute the increase for the field Area the following:

yyz(t)-yyz(t-12).

T es month. The table has this structure

Area yyz date Y

Area represents different locations. Each area has only one record per month. Month is obviously the field Date. And Y is yyz(t)-yyz(t-12).

I tried to use DateAdd on access 2013 but the function seems strange, and besides, i don't know how to link
Area yyz(t) date Y:yyz(t)-yyz(t-12).

I just want to create a query in which i can see for each record his yyz value this month and yyz the last year on Y.

View 12 Replies View Related

Queries :: Criteria That Looks For Records Like Current Year Only For A Date Field

Oct 12, 2014

How do you write a MS Access query criteria that looks for records like the current year only for a date field ? I tired Like *Year(Now()), it did not work.

View 8 Replies View Related

Queries :: Date / Time Field - Query Criteria To X Quarter Of Y Year

Jul 24, 2014

I have a form (frmMetrics) with 2 Combo Boxes: "Year" and "Quarter" These are just number fields (which might be my problem?)

I have a date/time field in a query, and I want the criteria to be based off the year and quarter selected in frmMetrics.

View 2 Replies View Related

Queries :: Determine Date Given Day Of Year And Year

Jul 3, 2014

I have fields [DayOfYear] and [Year] can I somehow produce the dd/mm/yyyy from this. I know how to do it in Excel but the Asscess function Date() is a little different.

I.e. if [DayOfYear] =152, [Year] = 2014 then [Date] = 2/6/2014

View 6 Replies View Related

Queries :: Field Header In Query Based On Other Field Data

Jun 28, 2013

I have two tables that are joined - called A and B. A has two fields, "PLACE" and "RAND" and is joined to B via field "RAND". Other than "RAND", B has several fields named 01 TOTAL, 02 TOTAL, 03 TOTAL, etc...for about 60 fields.

The "PLACE" field in table A has data that is 01, 02, 03, ect.... How do I structure a query so that whatever "PLACE" is, I can match the XX TOTAL value? In other words, i need to have the query field header be somehow dependent on the value in "PLACE".

Is this even possible?

View 4 Replies View Related

Queries :: Calculated Field To Display Value Of One Field Based On Another

Jul 23, 2015

I have a query with a Date field for EndDate (the dates for end-of-week, Fridays in our case) and another field for Sales (number of sales, not dollars).I want to add 4 calculated fields that represent weeks and have the Sales appear in the correct column (field) for that date.So I will have columns for 10 July 15, 17 July 15, 24 July 15 and 31 July 15 and I want the Sales for each record to land in the correct date column, based on the EndDate column. (The 4 fields is just for the sake of the example, I will actually be having dozens of these calculated date fields).I tried to do it by setting up the 4 calculated fields like:

10Jul15: Sales
and then adding Criteria like:
EndDate = #10/07/2015#
It doesnt work.

View 3 Replies View Related

Sort Records Based On Fiscal Year

Oct 14, 2005

I would like to sort records based on fiscal year for a chart. The fiscal year would be 7/01/2003 to 06/30/2004. I would like to sort this based on oldest date to newest date. This query could span several fiscal years. Any help would be greatly appreciated.

View 7 Replies View Related

Queries :: Showing A Field Based On Another Field

Jul 8, 2014

I was wondering if it is possible to determine weather to show a field based on the values from another field.

Field1, SHOW_Field1, Field2, SHOW_Field2
Field1 and Field are text, SHOW_Field1 and SHOW_Field2 are Boolean values

So if SHOW_Field1 is true, then show Field1 in the query else hide. I was wondering how to do this, I seem to not be able to do this for some reason.

View 3 Replies View Related

General :: Set Up Values In Table Based On Starting Year And Length Of Period

Jun 12, 2014

I have a table period with three columns

ID, Period_Start_Year, Period_End_Year

I could have many periods in a future. What i want is to allow users to insert just first start year and lenght of period and table will be automatically updated based on these two values.

So user will insert Period_Start_Year and Length of Period, for example 2010 and 2 and table should be>

ID Period_Start_Year Period_End_Year
1 2010 2011
2 2012 2013
3 2014 2015

While i am writing this i realised that user have to specify also ending year, i do not want to have infinity.. I am thinking about form and update query but can't get it...

View 1 Replies View Related

Queries :: Sum Based On Partial Field?

Aug 1, 2013

I'm trying to build a query that groups data by a code that is six digits. however, I only want to consider the first 4 digits when grouping by. (ex. table has code 100023 and I only want to group by 1000). Is there a way to do this within a query instead of modifying the table itself?

View 1 Replies View Related

Queries :: Value From Column Based On Value In Field

May 14, 2013

Is Access SQL able to do this:I want the value from a particular column, whose name is derived from the value in the field of another column?

Eg.
Col1 Col2 Col3 Col4 Col5
1 ABC 234 Col2 ABC
2 BCD 345 Col3 345
3 CDE 456 Col2 CDE
4 DEF 567 Col2 DEF
5 EFG 678 Col3 678
6 FGH 789 Col2 FGH

As you can see, I want the value in column 5 to be derived from the value in Column 4.Is this possible to be done in SQL.

View 7 Replies View Related

Queries :: How To Replace A Field With A Different Word Based On Its Value

Mar 15, 2013

I have a seating chart with 33 tables. Under each table there is a number that represents seats taken. I want to do a query that changes the number when it is a certain value. For example, when the value is null I want it to say "Empty", when the value is 10 I want it to say "Full" and when the value is over 10 I want it to say "Over". If the value is 1-9 I want to leave it as is.I know how to accomplish one at a time but not all three together. I've been useing:

Nz([Table#],"Empty")
IIf([Table#]=10,"Full",[Table#])
IIf([Table#]>10,"OVER",[Table#])

[code]....

View 6 Replies View Related

Queries :: Query To Total Based On Value Of A Field?

Jul 31, 2013

the relevant fields look something like this:

TellerNum - Date - Field1 - Field2 - Field2

I need a way for my query to take all rows with the same TellerNum and add Field1, Field2, and Field3 together for those records. So, there may be 20 records with the same TellerNum, and I need Field 1, 2, and 3 to be added together and then totaled for all 20 records to give me 1 grand total. I need this to be done for each TellerNum, so that the results will be a grand total for each TellerNum. So, the results may look something like this:

TellerNum 1: 486
TellerNum 2: 300
TellerNum 3: 240
etc..

View 3 Replies View Related

Queries :: Querying A Formula Based Field

Apr 8, 2013

I have a field in my query which returns results based on a formula that is a function of other fields. The results are: Pass and Fail. I want to make a query that returns only Fail rows. When I enter Fail as the criteria, a parameter box pops up requesting information be entered before continuing.

View 1 Replies View Related

Queries :: If Function - Calculations Based On Field

Dec 15, 2014

I would like queries to do some calculations for me based on a field. The field in the form is a combo field and the user can choose either 1, 2 or 3. Based on the selection, I would like queries to generate some numbers for me.

This is what I have in mind but its not working.

Code : TEST RESULT: If([tlkpTEST].[RESULTID])=1, ([tlkpTEST].[RESULTID])*2, 100)

View 2 Replies View Related

Queries :: Query Based On Attachment Field?

Jan 24, 2015

I would like to know what criteria is used to return records based on a field with data type attachment.

I am using "IsNull" and "IsEmpty" but neither of these work.

View 2 Replies View Related







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