Hi,
I've put together the following simple vB function to convert regular months to financial months for a yr on yr comparison report. It seems to work fine but the results are shown as text, this then leads to problems in getting the Minimum and Maximum etc.
Obviously I can convert the results to Integers but (using CInt) but this slows up an already lengthy process.
Why is the result text? (I've declared the intMth and intResultMth as Integers at the Option Explicit stage)
If you know a better way to complete the month to fiscal month conversion, don't be shy!
Many Thanks
Jim
Public Function FinancialMth(psmth As Integer) As Integer
intMth = psmth
Select Case intMth
Case 4
intResultMth = 1
Case 5
intResultMth = 2
Case 6
intResultMth = 3
Case 7
intResultMth = 4
Case 8
intResultMth = 5
Case 9
intResultMth = 6
Case 10
intResultMth = 7
Case 11
intResultMth = 8
Case 12
intResultMth = 9
Case 1
intResultMth = 10
Case 2
intResultMth = 11
Case 3
intResultMth = 12
Case Else
intResultMth = 12
End Select
FinancialMth = intResultMth
End Function
I've put together the following simple vB function to convert regular months to financial months for a yr on yr comparison report. It seems to work fine but the results are shown as text, this then leads to problems in getting the Minimum and Maximum etc.
Obviously I can convert the results to Integers but (using CInt) but this slows up an already lengthy process.
Why is the result text? (I've declared the intMth and intResultMth as Integers at the Option Explicit stage)
If you know a better way to complete the month to fiscal month conversion, don't be shy!
Many Thanks
Jim
Public Function FinancialMth(psmth As Integer) As Integer
intMth = psmth
Select Case intMth
Case 4
intResultMth = 1
Case 5
intResultMth = 2
Case 6
intResultMth = 3
Case 7
intResultMth = 4
Case 8
intResultMth = 5
Case 9
intResultMth = 6
Case 10
intResultMth = 7
Case 11
intResultMth = 8
Case 12
intResultMth = 9
Case 1
intResultMth = 10
Case 2
intResultMth = 11
Case 3
intResultMth = 12
Case Else
intResultMth = 12
End Select
FinancialMth = intResultMth
End Function