try this codes
Dim newVal As String, curVal As String, seq As String,maxIncidentID
If DMax("[intIncidentID]", "tblIncidents") > 0 Then
curVal = DMax("[intIncidentID]", "tblIncidents")
'test if the day is the same
If Left(curVal, 4) = Cstr(Year(Date)) Then
seq = Format(Right(curVal, 4) + 1, "0000")
newVal = Year(Date) & seq
Else
newVal = Year(Date) & "0001"
End If
Else
newVal = Year(Date) & "0001"
End If
maxIncidentID=newVal