Autonumber

  • Thread starter Thread starter James
  • Start date Start date
J

James

Hello I have an auto number field which I am using for a
refrence field...

I would like the refrence field to have 2 letters (MH) and
5 numbers... and to randomise them obviously so each
refrence is diffrent...

Is there any way I could do this?

Many Thanks

James
 
I would like the refrence field to have 2 letters (MH) and
5 numbers... and to randomise them obviously so each
refrence is diffrent...

If the two letters always say MH, then don't store them, just add them
using the Format property of the text box.

HTH


Tim F
 
I have an auto number field that has specific data-an
autonumber. 2004-001,2004-00. In the design view of the
autonumber field, enter a "format". Mine reads \200"4-
"000. I kind of worked it out seat-of-the-pants. But it
works. You might try "MH"000 Then set your autonumber
to either increment or random and set index to yes, no
duplicates. Hope this helps.
 
Hello I have an auto number field which I am using for a
refrence field...

I would like the refrence field to have 2 letters (MH) and
5 numbers... and to randomise them obviously so each
refrence is diffrent...

Is there any way I could do this?

Many Thanks

James

An Autonumber type field WILL NOT WORK in this instance. A Random
autonumber is a Long Integer in the range -2^31 to 2^31-1 - some two
billion odd either side of zero.

As noted elsethread, the letters MH should not be stored; just use a
Format to display the number with the letters preceding.

By randomize them, do you mean that you want sequentially assigned MH
numbers to be random numbers in the range 00000 to 99999? Or can they
be sequential (and unique)? If so you can use some VBA code to assign
them but the code would be different. Post back if you'ld like to
pursue this.
 
Ok hello there... I have done as you have requested but it
seems to want to put like a 12 disgit number in... I only
need a 5 digit number randomised and not`negative. I have
the MH12345678910.. I would like something like MH12345..
randomised...

Could this be done?

Many Thanks

James
 
I only
need a 5 digit number randomised and not`negative.

An autonumber will not do this. An incrementing one will limit the number
of digits (until you have gone past the 99999 mark, obviously), but a
random will will pick values from the entire Signed Long domain -- about
plus or minus 32 billion, I think. Anyway, it's more than five digits.

You'll need to program your own -- it's not hard, and there is lots of
example code on the web. Try googling for Access Custom Autonumber. There
are special precautions to take for multiuser architectures, for example.

I would, however, question the word "need". Clearly, I don't know your
business needs, but I wonder if the benefit from the rules stated above
really outweigh the extra work for you and the restrictions on your users
that they will impose. Just a thought.

HTH


Tim F
 
Ok thanks for that I have set my field up for an
incriment... How do I get it to say for example
MR00001,MR00002

I have it working to an extent.. I have the following
format: "MR"#

Which gives me MR1,MR2,MR3 and so on... How can I get
format to match what I want above?

Many Thanks

James
 
Ok thanks for that I have set my field up for an
incriment... How do I get it to say for example
MR00001,MR00002

I have it working to an extent.. I have the following
format: "MR"#

Which gives me MR1,MR2,MR3 and so on... How can I get
format to match what I want above?

"MR"00000
 
Back
Top