Thanks for the posts guys.
I have been looking into this a bit. Problem was i had REF0001,REF0002,REF0003 e.t.c. Then someone typed in REF999 instead of REF0999.
I didn't know about this problem until i entered REF10000 and thought i had lost the record but as you say it puts it after REF100...