Hello everyone, I hope someone can help me with this vb code for an afterupdate event. The code works but for some reason it is not recognizing the Fiscal year I thought I set it up for. For example FY2009 will end March 31st, 2010. The new FY2010 will begin April 1st,2010. But if I tried to create a record in March 2010 it is creating AutoCustomNumber with 09 instead of 10. Please help:
Private Sub Combo73_AfterUpdate()
Const FMonthStart = 4
Const FDayStart = 1
Const FYearOffset = -1
If IsNull(Me![BaseID]) Then
Me.DateID = (Year(Date) - IIf(Date < DateSerial(Year(Date), 4, 1), 1, 1) + 1)
Me![BaseID] = Format(Nz(DMax("[BaseID]", "[tbl_ImportLog]", "[YearID]=" & Me.DateID), 0) + 1)
End If
Me![ImportLog_ID] = [TrasportationType_ID] & "-" & right([YearID], 2) & "-" & Format([BaseID], "00000")
End Sub
Private Sub Combo73_AfterUpdate()
Const FMonthStart = 4
Const FDayStart = 1
Const FYearOffset = -1
If IsNull(Me![BaseID]) Then
Me.DateID = (Year(Date) - IIf(Date < DateSerial(Year(Date), 4, 1), 1, 1) + 1)
Me![BaseID] = Format(Nz(DMax("[BaseID]", "[tbl_ImportLog]", "[YearID]=" & Me.DateID), 0) + 1)
End If
Me![ImportLog_ID] = [TrasportationType_ID] & "-" & right([YearID], 2) & "-" & Format([BaseID], "00000")
End Sub