Generating Random Numbers and Letters in Access

B

BillyBob

Is there a method to populate a field with random numbers
(preferably letters, but numbers will do) in Access XP?
Can't seem to find anything in the books or help.
Thanks.
 
J

John Vinson

Is there a method to populate a field with random numbers
(preferably letters, but numbers will do) in Access XP?
Can't seem to find anything in the books or help.
Thanks.

The Rnd() function returns a random double float between 0 and 1. Are
you creating new records, or updating a field in existing records? Do
you want... what? a random number between 1 and 10? a random text
string between AAAAAAAA through GHKZABBQ to ZZZZZZZZ? or what?
 
J

John Vinson

What I want to do is populate a field in an existing row
with a 4 character random letter between AAAA and ZZZZ.
Thats all I need.

Try updating to:

Chr(65 + CInt(26*Rnd()) & Chr(65 + CInt(26*Rnd()) & Chr(65 +
CInt(26*Rnd()) & Chr(65 + CInt(26*Rnd())
 

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