473,831 Members | 2,462 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fiscal Year

11 New Member
Hi!

I wanted to modify the query the query is given below.

SELECT Format([OpDate],"yyyy") AS [Year], ProcFees.ProcNa me, Count(ProcFees. ProcName) AS CountOfProcName
FROM ProcFees INNER JOIN (Procedures INNER JOIN ProcDetails ON Procedures.[Order ID] = ProcDetails.[Order ID]) ON ProcFees.[Proc ID] = ProcDetails.[Proc ID]
WHERE ProcFees.ProcNa me<>"General Anaesthetic" And ProcFees.ProcNa me<>"Local Anaesthetic"
GROUP BY Format([OpDate],"yyyy"), ProcFees.ProcNa me
HAVING ((Format([OpDate],"yyyy")<>"IsNu ll") And (ProcFees.ProcN ame<>"IsNull")) ;

The above query generates following results:

Year Procedure Year Total
2000 Abdominoplasty 4
2000 Bilat Pinnaplasty 3
2001 Abdominoplasty 1

I actually gives the procedure and its total for the year starting at 1st January and ending at 31st December.i want to edit the query so it may provide me results starting at 1st Apr and ending at 31st March. i.e for year 2006 should now start at 1st Apr 2006 and end at 31st March 2007 and for year 2007 i would start at 1st Apr 2007 and end at 31st March 2008.

I am unable to create any such query.
Could anyone help me out please. It would be really apreciated if you could give me the exact query for the solution.

Thanking in Advance.
Uzair
Jun 27 '07 #1
7 1702
MMcCarthy
14,534 Recognized Expert Moderator MVP
You can't do this with a simple query. You could work out the criteria to return the data for one fiscal period but not to group the data by that fiscal period.

You will need to introduce a new column to the table for the FiscalYear with a value something like "2006/2007"

Then create a update query like the following to populate the column.

Expand|Select|Wrap|Line Numbers
  1. Update TableName SET FiscalYear = IIf(Month([OpDate])>3, """ & Year([OpDate]) & "/" & Year([OpDate])+1 & """, """ & Year([OpDate])-1 & "/" & Year([OpDate]) & """
  2.  
Once you have done that you can now run the query as follows:
Expand|Select|Wrap|Line Numbers
  1. SELECT ProcFees.FiscalYear, ProcFees.ProcName, Count(ProcFees.ProcName) AS CountOfProcName
  2. FROM ProcFees INNER JOIN (Procedures INNER JOIN ProcDetails ON Procedures.[Order ID] = ProcDetails.[Order ID]) ON ProcFees.[Proc ID] = ProcDetails.[Proc ID]
  3. WHERE ProcFees.ProcName<>"General Anaesthetic" And ProcFees.ProcName<>"Local Anaesthetic"
  4. GROUP BY ProcFees.FiscalYear, ProcFees.ProcName
  5. HAVING ((Format([OpDate],"yyyy")<>"IsNull") And (ProcFees.ProcName<>"IsNull"));
  6.  
I haven't touched the Having part as I'm not sure what if anything it is doing.
Jun 29 '07 #2
uzairahm
11 New Member
Thanks for u'r intrest.

I am real novice to Access so could you please tell me how would i be able to run the below sql you mentioned

UPDATE Procedures SET FiscalYear = IIf(Month([OpDate])>3, """ & Year([OpDate]) & "/" & Year([OpDate])+1 & """, """ & Year([OpDate])-1 & "/" & Year([OpDate]) & """);

What i have done to run this query was i added a column named FiscalYear in the Procedures database and gave its datatype to Date/Time but following message is shown:

"Procedure didn't update 61 Fields due to type conversion failure, 0 records due to key violation,..... .."

What should be the data type of Fiscal Year?

And when ever a new procedure would be added, fiscal year would be auto populated or i have to run the above mentioned query again.

I really appreciate the help you have provided.

Thanking in Advance,
Uzair.
Jun 29 '07 #3
MMcCarthy
14,534 Recognized Expert Moderator MVP
Thanks for u'r intrest.

I am real novice to Access so could you please tell me how would i be able to run the below sql you mentioned

UPDATE Procedures SET FiscalYear = IIf(Month([OpDate])>3, """ & Year([OpDate]) & "/" & Year([OpDate])+1 & """, """ & Year([OpDate])-1 & "/" & Year([OpDate]) & """);

What i have done to run this query was i added a column named FiscalYear in the Procedures database and gave its datatype to Date/Time but following message is shown:

"Procedure didn't update 61 Fields due to type conversion failure, 0 records due to key violation,..... .."

What should be the data type of Fiscal Year?

And when ever a new procedure would be added, fiscal year would be auto populated or i have to run the above mentioned query again.

I really appreciate the help you have provided.

Thanking in Advance,
Uzair.
The datatype should just be text. You will need to set up a procedure to add the Fiscal Year to new records.

Once we get the query sorted you can tell me how the records are being added. Presumably you are using a form.
Jun 29 '07 #4
uzairahm
11 New Member
Thanks a lot i figured it out. I kept FiscalYear's DataType as Text and my problem is solved Thank You so much.
Jun 29 '07 #5
uzairahm
11 New Member
weel the input is through form where the record for Procedures is added.
And i entered the update sql as Queries not as procedure.

What would be the method of running this query. Should i ammend it with insertproc query if so show should it be ammended.

regards,
Uzair
Jun 29 '07 #6
MMcCarthy
14,534 Recognized Expert Moderator MVP
weel the input is through form where the record for Procedures is added.
And i entered the update sql as Queries not as procedure.

What would be the method of running this query. Should i ammend it with insertproc query if so show should it be ammended.

regards,
Uzair
The update query was just a one off to amend your existing records.

On the form you use to add new procedures. In design view you need to drag the FiscalYear Field on to the form from the Field list.

Then go to the control for the OpDate field and create an After Update event as follows:

Expand|Select|Wrap|Line Numbers
  1. Private Sub OpDate_AfterUpdate()
  2.     If Month(Me.OpDate) > 3 Then
  3.         Me.FiscalYear = """ & Year(Me.OpDate) & "/" & Year(Me.OpDate)+1 & """
  4.     Else
  5.         Me.FiscalYear = """ & Year(Me.OpDate)-1 & "/" & Year(Me.OpDate) & """
  6.     End If
  7. End Sub
  8.  
Jun 29 '07 #7
FishVal
2,653 Recognized Expert Specialist
Hi!

I wanted to modify the query the query is given below.

SELECT Format([OpDate],"yyyy") AS [Year], ProcFees.ProcNa me, Count(ProcFees. ProcName) AS CountOfProcName
FROM ProcFees INNER JOIN (Procedures INNER JOIN ProcDetails ON Procedures.[Order ID] = ProcDetails.[Order ID]) ON ProcFees.[Proc ID] = ProcDetails.[Proc ID]
WHERE ProcFees.ProcNa me<>"General Anaesthetic" And ProcFees.ProcNa me<>"Local Anaesthetic"
GROUP BY Format([OpDate],"yyyy"), ProcFees.ProcNa me
HAVING ((Format([OpDate],"yyyy")<>"IsNu ll") And (ProcFees.ProcN ame<>"IsNull")) ;

The above query generates following results:

Year Procedure Year Total
2000 Abdominoplasty 4
2000 Bilat Pinnaplasty 3
2001 Abdominoplasty 1

I actually gives the procedure and its total for the year starting at 1st January and ending at 31st December.i want to edit the query so it may provide me results starting at 1st Apr and ending at 31st March. i.e for year 2006 should now start at 1st Apr 2006 and end at 31st March 2007 and for year 2007 i would start at 1st Apr 2007 and end at 31st March 2008.

I am unable to create any such query.
Could anyone help me out please. It would be really apreciated if you could give me the exact query for the solution.

Thanking in Advance.
Uzair
Hi!

The following expression will return fiscal year of [OpDate] whish starts at 1st Apr. -3 is the number of last month in fiscal year with "-" sign.

Year(DateAdd("m ", -3, [OpDate]))

Good luck.
Jun 29 '07 #8

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

Similar topics

1
2504
by: MissiMaths | last post by:
This isn't really an access question as I can write the code myself(I hope) but need to know how the start of the financial year is worked out. If someone knows the rules or an algorithm, I would be most grateful. In 2001, when the 1st April 2004 was on a sunday, the first (monday to friday) week of the financial year was the 9th to 13th April. In 2002, the 1st was on a monday and the first week was 8th to 12th april. In 2003, the 1st...
3
6942
by: haydn_llewellyn | last post by:
Hi, My company runs on a fiscal calendar that starts on the first monday in July, and is based on a 13 week quarter (4 weeks, 4 weeks, 5 weeks). What I need, is a way of relating Date() to the actual fiscal month (e.g. today is 01/07/05, and is the last day in June in our fiscal calendar). I tried many methods, and had hoped that DatePart() with the 'ww' flag and DatePart() with the 'w' flag (to choose the first monday in July,
2
11780
by: JohnC | last post by:
This fantastic expression was posted by Duane Hookom. I have no idea how it works but it displays the fiscal year and quarter for FY starting on October 1. =Format$(DateAdd("q",1,),"\Qq yyyy",0,0) It displays the first quarter for FY 2007 as Q1 2007. However I would like to display this as 2007 Q1. I couldn't get this to work.
1
7637
by: rkohon | last post by:
Hello all, I am new to JavaScript and need some ideas, suggestions, or code snippets. I have a form which requires the end user to put in a date for required items. I need javascript function to run on this date supplied by end user and for it to populate another area of the form with the Fiscal Year that this will be needed in. Example: User populates form field with 25-SEPT-07 we need the the Quarter required to immediately poplate...
4
2691
by: Twobridge | last post by:
Hi I am trying to perform a search that will return records based on a fiscal year search of the bill_Date. The user gives the year then I want to search based on the fiscal year (July 1 - June 30) for the year given. The table looks like this Bill Table id_Num bill_date bill_amount 23 7/1/2005 500.00
2
2635
by: Sund via AccessMonster.com | last post by:
I do fair amount of data analysis using access pivot tables and charts. Can any body suggest a method to run the queries based on accounting month and Accounting year.As an example: I want to analyze sales order per month and per Quarter. Our fiscal First quarter starts at 1st April with start date as April 1st and End date as 29 April ( Each month ends at Last Sunday of that month) I appreciate any comments. Thanks in advance
4
1844
by: ltazz | last post by:
How can i make it so that Access will Recognize the fiscal year 07 start at 1 oct 2006, and end 30 Sep 2007? i know its possible, however cant figure it out. Thanks for the help in advance you guys are great!
3
2092
by: shiznaw | last post by:
I got another problem while working on this database for the Univ. The Form.viewreports has several radial button options so that the user can view a Report for several periods--like a day, a week, a month, etc. The frame is linked to a select case statement. The user is also able to choose the radial button options: "fiscal year" and "fiscal year-to-date" reports. The fiscal year for the univ. starts on July 1st. The Query that...
6
6308
craigfr
by: craigfr | last post by:
I am making a graph comparing last year's defect data with YTD defect data. Our fiscal year starts Nov.1 and ends Oct.31. To get the YTD, I started used a simple date serial criteria: Between DateSerial(Year(Date())-1,11,1) And Date() This works, but only for 10 months out of the year. If your'e in December, it will calculate the YTD from last year's November to the current December, not the last November. My solution was to make an...
2
4321
by: RZ15 | last post by:
Hi guys, I'm really drawing a blank here for how to deal with fiscal months in my monthly sales/receipts reports. My issue is that calculating the months is not as simple as saying 'if the invoice date is january then sum sales' because the first period may include the end of december or even the beginning of february and not all of january. To help me with my problem, it's probably helpful to not think of it as fiscal months but think of...
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10777
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...
1
10534
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
10208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9317
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
7748
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
6951
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();...
1
4417
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3964
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.