PDA

Click to See Complete Forum and Search --> : Autonumbers with extensions


ronheywood
Jan 10th, 2000, 07:54 PM
How do I create an autonumber command for Access 97 that creates a sequential number following the following format:

p00/nn. where 00 is the year created?

I'm using the RND() command at the moment in the following construct:

="p" YEAR(NOW())"/"rnd(1-99)

Which returns a value of P2000/nn.

So I would like to condense the YEAR(NOW()) to return only the last two digits of the year.

Also the rnd statement returns a random number between 1 and 99, which is fine for my purposes, but it would be better if it could be made to return the next unused number in the sequence.

Any ideas?

Thanks

------------------
Ron Heywood

Clunietp
Jan 11th, 2000, 12:11 AM
Looks like you'll have to enforce this via code, not via Access autonumber rules...Access doesn't have anything like a trigger to do this for you

ronheywood
Jan 12th, 2000, 07:09 PM
It'll have to be done in the form of a query generated output anyway I assume, because we need to get the last number and increment it by one, but leave the year as Now() trimmed to the "yy" format.

SQL looks like the next step unless anyone has any better ideas.

Thanks for your help.