|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
fiscal year format
I work for a company that has a fiscal year calendar like the public schools.
I would like to have my forms in Access go on a fiscal year calendar. Is there any way that access will let me change the date format so that November of 2003 is recognized as the new fiscal year of 2003-2004. Any help will be appreciated. |
|
#2
|
||||
|
||||
|
Just copy the following function into a new module and then call the function fiscalyear(anydate,"FY","Begin") to get Fiscal year begin date nad fiscalyear(anydate,"CY","Begin") to get Calendar year begin date.
Public Function FiscalYear(InDate As Date, FYorCY As String, BeginOrEnd As String) As Date 'Assumption your date setting in regional settings in control panel is yy/mm/dd 'Sample Usage------- 'CY - Calendar Year 'FY - Fiscal Year 'FiscalYear(Date(),"Begin") returns 01/01/03 'FiscalYear(Date(),"FY","Begin") returns 01/11/03 'FiscalYear(Date(),"CY","End") returns 31/12/03 'FiscalYear(Date(),"FY","End") returns 31/10/03 Dim InMonth As Integer InMonth = Month(InDate) Select Case FYorCY Case Is = "CY" If BeginOrEnd = "Begin" Then FiscalYear = CVDate("01/01/" & Str(Year(InDate))) Else FiscalYear = CVDate("12/31/" & Str(Year(InDate))) End If Case Is = "FY" Select Case BeginOrEnd Case Is = "Begin" If Month(InDate) < 11 Then FiscalYear = CVDate("11/01/" & Str(Year(InDate)) - 1) Else FiscalYear = CVDate("11/01/" & Str(Year(InDate))) End If Case Is = "End" If Month(InDate) < 11 Then FiscalYear = CVDate("10/31/" & Str(Year(InDate) + 1) - 1) Else FiscalYear = CVDate("10/31/" & Str(Year(InDate) + 1)) End If End Select End Select End Function
__________________
V.Subramanian |
|
#3
|
|||
|
|||
|
supersubra...
I have a need to establish Calendar and Fiscal dates also and set start and end dates as parameters for reports, etc.. My question is, what does your code do for me. Forgive my ignorance, I’m a fairly new user. This is the first time I have used the Forum. It's a little daunting. Thanks B. Ray |
|
#4
|
||||
|
||||
|
Suppose you want to prefix (defaulting the values) the date to calendar year begin and end in text boxes for from and to fields in the selector form of a report
all you have to do is Paste the following code into form open event of any form that you are going to use for opening the report. //Code begin forms!formname!fromdate = FiscalYear(Date(), "CY", "Begin") As Date forms!formname!todate = FiscalYear(Date(), "CY", "End") As Date //Code end formname = Name of the selector form fromdate = Name of the textbox holding starting date todate = Name of the textbox holding end date. Before achieving this you have to copy the entire function in a separate module. For any clarification you can call me back. |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > fiscal year format |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|