Dont want to knock @arnelgp 's work, his solution certainly does work, but custom keys are worse than bad, make sure you use an autonumber inside your database as the "real" primary key.
While @arnelgp 's work works, I disagree with his approach. Because it limits you to 0001 = 9999 returns...