Auto-generate username and password

G

Guest

Hello, everybody,

I would like to have an auto-generated username and password with characters
taken from a CompanyName field but without any spaces or any other
characther not included in the CompanyName field.

What I have now considers 36 random characters and the code is:

Public Function fGenRandomString(intCharCount As Integer) As String
Dim i As Integer
Dim intPos As Integer
Dim strOut As String
Dim strOne As String * 1
Dim strCharPool As String
Const strChars = "abcdefghijklmnopqrstuvwxyz1234567890"

strCharPool = strChars
strOut = ""
If Not intCharCount > Len(strChars) Then
Randomize
For i = 1 To intCharCount
intPos = Int(Len(strCharPool) * Rnd + 1)
strOne = Mid(strCharPool, intPos, 1)
strCharPool = Left(strCharPool, intPos - 1) & Mid(strCharPool,
intPos + 1)
strOut = strOut & strOne
Next
Else
strOut = "Too Long"
End If
fGenRandomString = strOut
End Function
 
E

Ed Robichaud

Why do this at all? If the data is really that sensitive, Access has
reasonably good security features already built-in that you can use. Users
forced to remember foreign ID/PW's will just leave a post-it on the monitor,
or worse.
-Ed
 
G

Guest

Ed, thank you for your reply. I setup customers' access to online databases
and the information in the Access database is not public to customers. It's
just to keep a record for troubleshooting purposes. Right now, with the
characters in the code, it creates credentials such as "3ych2at6", that's why
I wanted to use the CompanyName field as characters generator.
 

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