Jim Specht
New member
- Local time
- Today, 01:47
- Joined
- Sep 14, 2000
- Messages
- 8
I am trying to create a custom function (which have need for often) in a Module. The function takes a date,(x), and returns the Fiscal year value. It works fine in a query where all values of the recordset are not null....but if just one record value is null, it returns an "Invalid use of Null (Error 94)" error. I can understand why it returns this but don't know how to accomidate it. Any suggestions...I'm not that great w/ code.
thx,
js
Here is my code:
;DECLARATIONS-----------
Option Explicit
Const FMonthStart = 6
Const FDayStart = 1
Const FYearOffset = -1
;GETFYR-------------
Function GetFYR(x As Variant)
If x < DateSerial(Year(x), FMonthStart, FDayStart) Then
GetFYR = Year(x) - FYearOffset - 1
Else
GetFYR = Year(x) - FYearOffset
End If
End Function
thx,
js
Here is my code:
;DECLARATIONS-----------
Option Explicit
Const FMonthStart = 6
Const FDayStart = 1
Const FYearOffset = -1
;GETFYR-------------
Function GetFYR(x As Variant)
If x < DateSerial(Year(x), FMonthStart, FDayStart) Then
GetFYR = Year(x) - FYearOffset - 1
Else
GetFYR = Year(x) - FYearOffset
End If
End Function