RE: Generate a random 6 character output

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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
.



Relevant Pages

  • Re: Generate a random 6 character output
    ... LTR has 10 letters and NUM numbers the letters 0-9. ... Dim ltr1 As Recordset, ltr2 As Recordset, ltr3 As Recordset ...
    (microsoft.public.access.modulesdaovba)
  • Re: casting a letter into an integer
    ... identification division. ... program-id. ... procedure division using ltr num. ...
    (comp.lang.cobol)
  • Re: Dumb street names
    ... the IDL was built. ... I vote for any of the "lettered" county highways in Ramsey County, ... They're legit numbered highways, but the street names are letters, ie ... behind the White House now that Pennsylvania Ave is closed. ...
    (misc.transport.road)
  • Re: Non-British "Enigmas"
    ... following letters to be typed in ... St Pancras station and its abutting hotel were owned and built by the ...
    (rec.music.classical.recordings)
  • Re: TypeR Meet
    ... Rocky wrote: ... You might want to keep it, you seem to lose a few letters now ... It's my dyslexic keyboard with built in spulchukkir wot does it. ...
    (uk.people.silversurfers)