473,395 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Tax Year Function

Hi

Does anyone know of a function I can use to return the current tax
year. Our tax year runs from 6 April. I need a function which will
return the tax year for a given date.

TIA

Nov 13 '05 #1
3 3242
It's not elegant, but here is one you can modify for your own use:

Public Function FY(varDate As Variant)

If IsNull([varDate]) Then FY = "": Exit Function

If ([varDate] >= #7/1/2002# And [varDate] <= #6/30/2003#) Then FY = 2003
If ([varDate] >= #7/1/2003# And [varDate] <= #6/30/2004#) Then FY = 2004
If ([varDate] >= #7/1/2004# And [varDate] <= #6/30/2005#) Then FY = 2005
If ([varDate] >= #7/1/2005# And [varDate] <= #6/30/2006#) Then FY = 2006
If ([varDate] >= #7/1/2006# And [varDate] <= #6/30/2007#) Then FY = 2007
If ([varDate] >= #7/1/2007# And [varDate] <= #6/30/2008#) Then FY = 2008
If ([varDate] >= #7/1/2008# And [varDate] <= #6/30/2009#) Then FY = 2009
If ([varDate] >= #7/1/2009# And [varDate] <= #6/30/2010#) Then FY = 2010
If ([varDate] >= #7/1/2010# And [varDate] <= #6/30/2011#) Then FY = 2011
If ([varDate] >= #7/1/2011# And [varDate] <= #6/30/2012#) Then FY = 2012
End Function

-Ed
<et*******@blueyonder.co.uk> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi

Does anyone know of a function I can use to return the current tax
year. Our tax year runs from 6 April. I need a function which will
return the tax year for a given date.

TIA

Nov 13 '05 #2
Try:
Year([InvoiceDate]) + ((Month([InvoiceDate] > 4) OR (Month([InvoiceDate] = 4
AND Day([InvoiceDate]) >= 6))

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<et*******@blueyonder.co.uk> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...

Does anyone know of a function I can use to return the current tax
year. Our tax year runs from 6 April. I need a function which will
return the tax year for a given date.

Nov 13 '05 #3
Function TaxYear(varDate) as integer
If varDate < DateSerial (Year(varDate), 4, 6 ) then
TaxYear =Year(varDate) -1
else
TaxYear=Year(varDate)
end function

--
Hope this helps
Arno R
<et*******@blueyonder.co.uk> schreef in bericht
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi

Does anyone know of a function I can use to return the current tax
year. Our tax year runs from 6 April. I need a function which will
return the tax year for a given date.

TIA

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ltamisin | last post by:
Hi Im working on a Year(Date) function right now, the output of that function is this "2005", my question is how can i change the format into this "05" Function: Year(Date) Output: 2005...
7
by: Fendi Baba | last post by:
The function is called from opencalendar(targetfield). Thanks for any hints on what could be the problem. .............................................................. var...
14
by: Protoman | last post by:
Hi!!! I need some help on a project I'm that calculates leap years; I'm getting errors that I have no idea what they mean; here's the code: #include <iostream> #include <cstdlib> using...
2
by: Douglas | last post by:
I have a Vehicle MOT field in my table which i have as a Date field I dont really want to hold the year, just 'dd mmm' as MOTs are the same date every year. I have the field on my form as a...
14
by: Alan | last post by:
Hi everyone! I'm trying to produce a periodic financial report on projects from various departments. My database is set up with the tables tblDepartment, tblProjects, tblPeriods, and tblBudgets...
18
by: Bruno Baguette | last post by:
Hello, I have to design a table wich will store some action reports. Each report have an ID like this 1/2004, 2/2004, ... and each years, they restart to 1 (1/2004, 1/2005, 1/2006,...). So, I...
3
by: jannoergaard | last post by:
Hi I want to write a function that can return a sum for a given date range. The same function should be able to return the sum for the same period year before. Let me give an example: The...
4
by: ssylee | last post by:
I have set my year value in the register on my RTC (DS1302) to be 2008 using this code: // This function sets the year on the RTC // Note: The year takes in only the last two digits of the year...
4
by: hallsers | last post by:
Here is the problem i am having: - When a user logs in, on page load it will take the dob of all users in a stored friends list and compare them against the following conditions - To display any...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...

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.