D
dailem
I'm writing a function that when finished will allow the user to
provide a date & it will return the fiscal month & year. It is in it's
early stages right now- basically just handling days between 6-25, as
they always fall in the calendar month/year. Problem is that when I try
to use the function, it doesn't work correctly. I even try using the
'Day' function to return the day #, but it only works if I surround it
with '#'s' on each side. I'm sure I'm overlooking something simple-
below is my code:
Function CNGFiscal(FiscalDate As Date) As String
'Create function which will return the fiscal year & month
'designed by dm, OCT-2006
Dim myYear As Integer
Dim myMonth As Double
Dim myDay As Integer
Dim FiscalYear As Integer
Dim FiscalMonth As Double
myYear = Year(FiscalDate) 'pull calendar year from input
myMonth = Month(FiscalDate) 'pull calendar month from input
myDay = Day(FiscalDate) 'pull calendar day # from input
Select Case myDay
Case 6 To 24
FiscalMonth = myMonth
FiscalYear = myYear
CNGFiscal = myMonth & "-" & myYear
Case 1 To 5
CNGFiscal = "one to five"
Case 25 To 31
CNGFiscal = "higher than twenty-five"
End Select
CNGFiscal = "not working"
End Function
....any thoughts, I'd appreciate it.
provide a date & it will return the fiscal month & year. It is in it's
early stages right now- basically just handling days between 6-25, as
they always fall in the calendar month/year. Problem is that when I try
to use the function, it doesn't work correctly. I even try using the
'Day' function to return the day #, but it only works if I surround it
with '#'s' on each side. I'm sure I'm overlooking something simple-
below is my code:
Function CNGFiscal(FiscalDate As Date) As String
'Create function which will return the fiscal year & month
'designed by dm, OCT-2006
Dim myYear As Integer
Dim myMonth As Double
Dim myDay As Integer
Dim FiscalYear As Integer
Dim FiscalMonth As Double
myYear = Year(FiscalDate) 'pull calendar year from input
myMonth = Month(FiscalDate) 'pull calendar month from input
myDay = Day(FiscalDate) 'pull calendar day # from input
Select Case myDay
Case 6 To 24
FiscalMonth = myMonth
FiscalYear = myYear
CNGFiscal = myMonth & "-" & myYear
Case 1 To 5
CNGFiscal = "one to five"
Case 25 To 31
CNGFiscal = "higher than twenty-five"
End Select
CNGFiscal = "not working"
End Function
....any thoughts, I'd appreciate it.