Adding random numbers to acrostic

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
 
S

Steve Coombes

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")
 
H

HSalim

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
 
S

Steve Coombes

Forgot to mention that you need to add the Randomize statement to your code
before running the Rnd function...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top