Custom SKU's

K

Keith Ward

Hi,

How can I create automatic SKU's that are 6 characters long and have letters
and numbers.

Makes for easier reading in a printed format.

Thanks
Keith
 
J

John Vinson

Hi,

How can I create automatic SKU's that are 6 characters long and have letters
and numbers.

I have no idea. What letters and numbers? How do you want them
arranged? Sequential, alphabetical, random? Anything from AAAAAA to
999999 via 3K41Q2 or what?

If you can define how you want these SKU's assigned, it would be
possible to write a VBA function to assign them. Probably using a
Form's BeforeInsert event would be the appropriate place; it could
search the table for existing SKU's and apply some algorithm that
you'll need to define to generate a new one.

John W. Vinson[MVP]
 
K

Keith Ward

Hi,

Yes, sequentially from AAAAAA to 999999 via 3K41Q2. I don't want codes with
all the same character though if possible, so AAAAAA, 999999, BBBBBB etc are
out. To be real picky I would only like only two of the same characters in
the code so AAA123, AA1A23, is out, but then I can live with it if that's
impossible.

How many combinations would that leave?

Thanks

Keith
 
J

John Vinson

Hi,

Yes, sequentially from AAAAAA to 999999 via 3K41Q2. I don't want codes with
all the same character though if possible, so AAAAAA, 999999, BBBBBB etc are
out. To be real picky I would only like only two of the same characters in
the code so AAA123, AA1A23, is out, but then I can live with it if that's
impossible.

How many combinations would that leave?

Hm. Quick combinatorial calculation, assuming no duplicate characters
at all: 36*35*34*33*32*31 = 1,402,410,240 combinations. Allowing a
single duplicate (anywhere) raises that to 1,628,605,440. Should last
a while!

I've seen postings with algorithms to generate such alphanumeric
autonumbers but I'm a bit too busy to go digging or to rewrite one
today - but yes, it's not hard.

John W. Vinson[MVP]
 
Top