Why do the codes need to be random? Wouldn't a unique serial number be sufficient?
An auto-entered serial number can be defined as a field in your table and it will enter a unique value each time you create a record in the table.
A calculation field can then format this value with leading zeroes to serve as the value for the barcodes:
Right ( "0000" & SerialNumber ; 5 )
This will work for codes from 00000 up to 99999.
Its good and worked out well, Actually the user will want to generate a given number of serials by entering the quantity of serials required.
For example the user enters 100 in the quantity field and then 100 serials are generated, then again when ever he wants to create more serials he will again enter a qty and more serials are then generated with increment from the last 100 serials generated.
A script can generate a specified number of new records in the table to generate that number of new codes. The user enters a number in a global field and then performs the script which loops to create the number of new records specified in the global field.