RE: Generate a random 6 character output
- From: Stephen sjw_ost <Stephensjwost@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 15 Nov 2009 14:59:02 -0800
Well I have built my own answer.
1 table with 2 fields. LTR and NUM.
LTR has 10 letters and NUM numbers the letters 0-9.
The following is the code I built from the help file.
Function RNDPassword()
Dim db As DAO.Database
Dim char1, char2, char3, char4, char5, char6
Dim ltr1 As Recordset, ltr2 As Recordset, ltr3 As Recordset
Set db = CurrentDb
Randomize
char1 = Int((6 * Rnd) + 1)
char2 = Int((6 * Rnd) + 1)
char3 = Int((6 * Rnd) + 1)
Set ltr1 = db.OpenRecordset("SELECT * FROM t_RND WHERE num='" & char1 &
"'")
Set ltr2 = db.OpenRecordset("SELECT * FROM t_RND WHERE num='" & char2 &
"'")
Set ltr3 = db.OpenRecordset("SELECT * FROM t_RND WHERE num='" & char3 &
"'")
char4 = Int((6 * Rnd) + 1)
char5 = Int((6 * Rnd) + 1)
char6 = Int((6 * Rnd) + 1)
Form_f_Test.txtrslt.Value = ltr1("LTR") & ltr2("LTR") & ltr3("LTR") &
char4 & char5 & char6
End Function
Of course you would want to move the output to where ever work for you.
I hope this helps someone.
--
Stephen
"Stephen sjw_ost" wrote:
I am looking for a way to randomly generate a 6 character output of letters.
and numbers like abc123 or 258qwe etc...
Can anyone show me how to do this or point me to some examples?
Thanks for any help.
--
Stephen
- Follow-Ups:
- Re: Generate a random 6 character output
- From: John W . Vinson
- Re: Generate a random 6 character output
- References:
- Generate a random 6 character output
- From: Stephen sjw_ost
- Generate a random 6 character output
- Prev by Date: Re: Controlling the DatePicker
- Next by Date: RE: Delete sent email
- Previous by thread: Generate a random 6 character output
- Next by thread: Re: Generate a random 6 character output
- Index(es):
Relevant Pages
|