sorry
this is the code
thanks for replying
is it abug?
Private Sub Form_BeforeInsert(Cancel As Integer)
If IsNull(DMax("serial", "table_name")) Then
field = 2005000001
Else
If (DatePart("M", date) = "4" And DMax("REF_id", "table_name", "month =
4")) Then
field = DMax("serial", "table_name") + 1
Else
If (DatePart("M", date) = "4" And DMax("REF_id", "table_name", "month =
3 ")) Then
field = CLng(CStr(DatePart("yyyy", date)) & "000001")
Else
field = DMax("serial", "table_name") + 1
End If
End If
End If
another_field = CStr(Right(field, 6) & "/" & Left(field, 4))
End Sub
here first check if it null
then if its abeginning of finanical year and not the first time
increase max
but if its abeginning of finanical year and it is the first time
then just begin 1 on the year
else
complete auto numbering
it work correctly but when iam on a new year it complete
numbering