Generate a Random Unique 4 digit number

Hi
I am new to this board and am trying to work out a little problem. I have a table of drivers who all have an Primary Key of ID numbers auto generated as each new record is saved. Each driver also has a unique 4 digit number that they use when logging into each vehicle. This has to be a random number to prevent drivers from knowing anyone else's number. As each new driver is added to the record the Random unique number should be automatically generated. I have been through my MS Access VB for Applications Fundamentals book many times and cannot find a solution to this. I would appreciate any suggestions on this.

here is a way to get a file name that is really random, it uses the epoch date plus 4 random digits.
randfile="r$(date +'%s')$(($RANDOM%10))$(($RANDOM%10))$(($RANDOM%10) )$(($RANDOM%10))";
or just the four random digits.
FourRandDigits="$(($RANDOM%10))$(($RANDOM%10))$(($ RANDOM%10))$(($RANDOM%10))";
oh wait isnt this a bash forum? oh well.

Combining the date and a random number is a solution, but there is a (very small) chance that a duplicate PIN / ID is generated when two or more ID 's are generated on the same day, so you should check if the ID already exists if you want to be 100% safe.

If the random were just a PIN, to be combined with additional ID it would not be a problem. Duplicate PIN is common in debit cards, but they must always be combined with a unique ID.

Furthermore, this solution exeeds the 'four digit criterium'.

Otherwise it's a simple and good solution, thanks for contributing to the community.