-----Original Message-----
If it helps, here are a couple of functions I use to extract the fiscal
year and fiscal month for a given date. These functions extract the FY
start month from a Profile table, but you could easily just hard-code
the value 7 (July) instead.
'----- start of function code -----
Function fncFiscalYear(InputDate As Variant) As Variant
' Given a date, returns the fiscal year it belongs in, based on the
' fiscal-year start month defined in the Profile.
'
' Copyright © 2002, Dirk Goldgar
' License is granted to use this code in your applications,
' provided the copyright notice remains intact.
Static intFYStart As Integer
' If we haven't already done so, get the start month of the fiscal
year
' from the Profile.
If intFYStart = 0 Then
intFYStart = fncProfileItem("FYStartMonth", 1)
End If
' Now use that information to calculate the fiscal year.
If IsNull(InputDate) Then
fncFiscalYear = Null
ElseIf IsDate(InputDate) Then
fncFiscalYear = Year(InputDate)
If intFYStart > 1 Then
If Month(InputDate) >= intFYStart Then
fncFiscalYear = Year(InputDate) + 1
End If
End If
Else
Err.Raise 5 'Invalid argument
End If
End Function
Function fncFiscalMonth(InputDate As Variant) As Variant
' Given a date, returns the month of the fiscal year in which it
falls,
' based on the fiscal-year start month defined in the Profile.
'
' Copyright © 2002, Dirk Goldgar
' License is granted to use this code in your applications,
' provided the copyright notice remains intact.
Static intFYStart As Integer
Dim intMonth As Integer
' If we haven't already done so, get the start month of the fiscal
year
' from the Profile.
If intFYStart = 0 Then
intFYStart = fncProfileItem("FYStartMonth", 1)
End If
' Now use that information to calculate the fiscal year.
If IsNull(InputDate) Then
fncFiscalMonth = Null
ElseIf IsDate(InputDate) Then
intMonth = (Month(InputDate) - intFYStart) + 1
If intMonth < 1 Then
intMonth = intMonth + 12
End If
fncFiscalMonth = intMonth
Else
Err.Raise 5 'Invalid argument
End If
End Function
'----- end of function code -----
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
.
Thanks for the help. I'll give it a try and let you know