Question Generating random project numbers with date

domini

New member
Local time
Today, 08:24
Joined
Jun 8, 2012
Messages
2
Hello

Could someone please explain how to generate random project numbers that reset automatically every month? I want to generate project numbers that look like this:

1234/06/12

where the 06/12 stands for the month and the year while the 1234 is a randomly generated number.

I want the random number to be four digits long.

I already have a number of projects with similarly generated projects from an existing database. Can I import these projects without changing their project number?

Thanks!
 
Hi domini,

Welcome to the forums

have a look here for the random number part
http://www.techonthenet.com/access/tables/random2007.php

You can alter the length of the number by altering the 'field size' to adjust for the length of the number.

i have just thrown this together - while not pretty it could do the job
Put in a field control source or as a string value in VBA

Code:
=Left((Rnd(Date())*100000),4) & "/" & Month(Date()) & "/" & Year(Date())

HTH
 
Hi McSwifty,

Thank you very much for your help. Would you be able to explain how to add the field control source or the string value in VBA too? I'm not at all familiar with Access yet.
 

Users who are viewing this thread

Back
Top Bottom