Can you say what other specifics you need? This particular function has been working well for years and only about couple of months i realized this has happened sporadically. That's why i was wondering if its my interaction with the database.
there's a lot of combined talent with all the volunteers that look at this thread, so the more detail you can provide, the more we can help.
lets see the vb6 function; maybe after years it's hitting the 32767 VB6 Integer limit, and the code is rolling over and creating repeats;
that's just a guess, but one possible explanation.
remember all i can tell about the issue, is what you post here; you've got the insiders look at the issue, but also insider assumptions that we know what you see, but we really can't; you have to post it here for us to see it too.
--help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!