Adding random numbers to acrostic

  • Thread starter Thread starter bumi
  • Start date Start date
B

bumi

I am trying to create an acrostic with the following
elements: abstractor code, location code and a 6 digit
random number.
I have the following:
Acrostic= [AbstractorCode] & [LocationCode]

but need the following:
Acrostic= [AbstractorCode] & [LocationCode] & [6 digit
Random#]

Can anyone help me figure out how to add a 6 digit random
number to the acrostic? I am able to obtain the first
two arguments without any problems but cant figure out
how to add a six digit random number to the acrostic.

thanks, bumi
 
Hi Bumi -

Simply place the following code segment into your code to return a 6-digit
string of random numbers in the range of 000000-999999:

Format(Int(999999 * Rnd), "000000")
 
dim Random as Long
Randomize ' Initialize random-number generator.
random = Int((999999 - 100000 + 1) * Rnd + 100000) ' Generate random value
between 999,999 and 100,000.
Acrostic= [AbstractorCode] & [LocationCode] & Random
 
Forgot to mention that you need to add the Randomize statement to your code
before running the Rnd function...
 
Back
Top