Hi I am hoping someone can help me, I am trying to creating an incrementing number using dmax which resets each year. Using the idea suggested on post linked below
http://www.access-programmers.co.uk/forums/showthread.php?t=67675&highlight=sequential+numbers+DMax+year
I have managed to create a number format which looks like 2010-1, 2010-2 etc using the following formula.
Private Sub Form_BeforeInsert(Cancel As Integer)
Me.DDRNumber = Format(Year(Date), "0000") & "-" & _
Format(Nz(DMax("Mid([DDRNumber], 6)", _
"tblDDR", _
"[DDRNumber] Like '" & Format(Year(Date), "0000") & "*'"), 0) + 1, "0")
End Sub
However I would rather the year came after the number eg.. 1-2010, 2-2010 but can not work out what I need to swap on the formula, it keeps bringing up errors.
Is anyone able to help me please ?? Happy to split the year and incrementing number if this would help.
http://www.access-programmers.co.uk/forums/showthread.php?t=67675&highlight=sequential+numbers+DMax+year
I have managed to create a number format which looks like 2010-1, 2010-2 etc using the following formula.
Private Sub Form_BeforeInsert(Cancel As Integer)
Me.DDRNumber = Format(Year(Date), "0000") & "-" & _
Format(Nz(DMax("Mid([DDRNumber], 6)", _
"tblDDR", _
"[DDRNumber] Like '" & Format(Year(Date), "0000") & "*'"), 0) + 1, "0")
End Sub
However I would rather the year came after the number eg.. 1-2010, 2-2010 but can not work out what I need to swap on the formula, it keeps bringing up errors.
Is anyone able to help me please ?? Happy to split the year and incrementing number if this would help.