Add Case select statement for fiscal year

ppoindexter

Registered User.
Local time
Yesterday, 21:47
Joined
Dec 28, 2000
Messages
134
Can anyone add 3 more case select statements to this code so users can select "Fiscal Year" as an option? Specifically take Case 610, Case 620 and Case 630 modify it so its the fiscal year dates and not calander dates.


Case 6 'Year to Date
txtStartDate = DateSerial(Year(Date), 1, 1)
txtEndDate = Date
Case 600 'Current Year
txtStartDate = DateSerial(Year(Date), 1, 1)
txtEndDate = DateSerial(Year(Date), 12, 31)
Case 610 'Last 12 Months
txtStartDate = DateSerial(Year(Date) - 1, Month(Date), Day(Date) + 1)
txtEndDate = Date
Case 620 'Last Year txtStartDate = DateSerial(Year(Date) - 1, 1, 1)
txtEndDate = DateSerial(Year(Date) - 1, 12, 31)
Case 630 'Year Before Last
txtStartDate = DateSerial(Year(Date) - 2, 1, 1)
txtEndDate = DateSerial(Year(Date) - 2, 12, 31)
Case Else
txtEndDate = " Missing Case! "
End Select
End Function

thanks in advance
 
i got it
i am posting it in case anyone needs it

Case 6 'Year to Date
txtStartDate = DateSerial(Year(Date), 1, 1)
txtEndDate = Date
Case 600 'Current Year
txtStartDate = DateSerial(Year(Date), 1, 1)
txtEndDate = DateSerial(Year(Date), 12, 31)
Case 610 'Last 12 Months
txtStartDate = DateSerial(Year(Date) - 1, Month(Date), Day(Date) + 1)
txtEndDate = Date
Case 620 'Last Year
txtStartDate = DateSerial(Year(Date) - 1, 1, 1)
txtEndDate = DateSerial(Year(Date) - 1, 12, 31)
Case 630 'Year Before Last
txtStartDate = DateSerial(Year(Date) - 2, 1, 1)
txtEndDate = DateSerial(Year(Date) - 2, 12, 31)
Case 640 'Current Fiscal Year
txtStartDate = DateSerial(Year(Date) - 1, 10, 1)
txtEndDate = DateSerial(Year(Date) - 1, 9, 30)
Case 650 'Next Fiscal Year
txtStartDate = DateSerial(Year(Date) - 0, 10, 1)
txtEndDate = DateSerial(Year(Date) - 0, 9, 30)
Case 660 'Last Fiscal Year
txtStartDate = DateSerial(Year(Date) - 2, 10, 1)
txtEndDate = DateSerial(Year(Date) - 2, 9, 30)
'
Case Else
txtEndDate = " Missing Case! "
End Select
End Function
 

Users who are viewing this thread

Back
Top Bottom