[AccessD] Calculate first day of financial year

Gustav Brock Gustav at cactus.dk
Sun Apr 19 04:57:15 CDT 2009


Hi Anita

I have used another (generic) method which is slightly different:

<code>
Public Function DateFinancialFirst() As Date
  
  Dim datFin    As Date
  Dim datNow    As Date
  Dim datFirst  As Date

  datNow = Date
  datFin = DateFinancial(datNow)
  datFirst = DateSerial(Year(datFin), 1 - DateDiff("m", datNow, datFin), 1)
 
  DateFinancialFirst = datFirst

End Function

Public Function DateFinancial( _
  ByVal datDate As Date) _
  As Date
  
  ' Number of months from start of calendar year to start of financial year.
  Const clngMonthOffset As Long = 3
  
  Dim datFinancial      As Date
  
  datFinancial = DateAdd("m", -clngMonthOffset, datDate)
  
  DateFinancial = datFinancial
  
End Function
</code>

You would need to adjust clngMonthOffset to 6 for your case.
/gustav


>>> miscellany at mvps.org 19-04-2009 10:10:13 >>>
Anita,

Don't know if anyone will come up with one more elegant than:
DateSerial(Year(Date())+(Month(Date())<7),7,1)

Regards
Steve


--------------------------------------------------
From: "Anita Smith" <anitatiedemann at gmail.com>
Sent: Sunday, April 19, 2009 7:39 PM
To: <AccessD at databaseadvisors.com>
Subject: [AccessD] Calculate first day of financial year

> Hi All,
> The financial year starts on the 1st of July in Australia.
>
> Does anyone out there have a nifty formula that I can use to calculate the
> first day of the current financial year based on todays date?






More information about the AccessD mailing list