i have an already compile version of the software but is using newer code and i just have the original (first) source code.

this is what the software does

we enter "last name" and "fist name"
ex.
"Jackson" "Michael"

the software then makes a code out of it
something like this
JACKMI001

the software looks for a query on the database and if there is another client with the same code (JACKMI001) then it adds a 1 to the counter which ends up like
JACKMI002

the software is suppose to do this but i cant (idk) how to make a query to do this or the software do this.

again thanks for your time and help