HELP!: Custom Auto Number - Not Recognizing Fiscal Year

ecastro

New member
Local time
Today, 07:09
Joined
Jul 22, 2009
Messages
9
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
 
If fiscal year 09 ends March 31, 2010, then
I tried to create a record in March 2010 it is creating AutoCustomNumber with 09 instead of 10
is not an error.
 
I am sorry you are correct, its the opposite way around, it is giving me 10 instead of 09, on the new records created. How would I change this?
 
Last edited:
Hi -

Here are a couple of examples that return the correct year:

Code:
x = #4/13/2010#
? Year(x) - IIf(x < DateSerial(Year(x), 4, 1), 1, 0)
 2010 
 
x = #3/13/2010#
? Year(x) - IIf(x < DateSerial(Year(x), 4, 1), 1, 0)
 2009

HTH - Bob
 
hello friends I want to make a field idno in my field like. " yyyy/incrment no. " (2015/0001) like this but I want that every 1st April increment no restart from 0001 and increment with 1. how to do it??
 

Users who are viewing this thread

Back
Top Bottom