Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Random Passwords in Access

Status
Not open for further replies.

dcorrea

IS-IT--Management
Aug 15, 2002
22
US
I am currently using MS Access XP and would like to be able to generate a four-digit random password. How would I be able to do this? Thanks in advance for your assistance.
 
This code will create a numeric 4 digit password string made from numbers.

Code
----
' Declare variable to hold password
Dim strPassword As String

' Initialise password to a blank string
strPassword = ""

' Create a password of 4 characters made up of numbers
Do Until Len(strPassword) = 4
strPassword = strPassword + Trim(Str(Int(Rnd() * 10)))
Loop

' Show the password created
MsgBox strPassword
 
Thanks for your quick response. Can you shed some light as to where this code should be added. Thanks again!
 
It can be used behind a button but it depends how and why you are creating the password.

Does it need to create a random password for a new user, then set the password? Is it a user password using access security to login to a database???

If so I am not sure how you would build it into the process of adding a new user. Perhaps you just have a menu option that creates a random number, write it down and assign it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top