Okay after a bit ( a lot actually) of trail and error I got IT
Private Sub InputBY_Exit(Cancel As Integer)
Me![3DigitCode] = Nz(DMax("[3DigitCode]", "[Main]", "[DateOpened] = #" & Forms!Main!DateOpened & "#"), 0) + 1
End Sub
It took me a while to realise there was something not quite right...