you probably want something like this, i havn't tested it
if isnull(DMax("[Ref]", "TableName", Mid([Ref],5,2) = Format(Date(),"mm") then
Me!Ref = "001/" & Format(Date(),"mm/yy")
Else Me!Ref = Format(Clng(Right(DMax("[Ref]", "TableName", Mid([Ref],5,2) = Format(Date(),"mm"),1,3))+1,"000") & "/"...