Password Box

S

Sandy

Hi
I have the following (from this newsgroup) which acts as a password box :-

Private Sub Administration_Click()

Dim strPasswd

strPasswd = InputBox("Enter Password", "Restricted Form")

If strPasswd = "" Or strPasswd = Empty Then
MsgBox "No Input Provided", vbInformation, "Required Data"
Exit Sub
End If

If strPasswd = "xxxxx" Then
On Error GoTo Err_Administration_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Administration"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "Navigation"

Exit_Administration_Click:
Exit Sub

Err_Administration_Click:
MsgBox Err.Description
Resume Exit_Administration_Click

Else
MsgBox "Sorry, you do not have access to this form", _
vbOKOnly, "Important Information"
Exit Sub

End If

End Sub

My question:
Is it possible to have asterisks showing in the input box rather than the
actual letters being typed?
Thanks
Sandy
 
P

Pietro

Hi Sandy,

I think you cannot,instead you can create a for to do the same function
having the password field's input mask as "Password"

Pietro
 
K

Klatuu

No, you will have to use a text box with the input mask property set to
"password"

Also, this line:
If strPasswd = "" Or strPasswd = Empty Then
is suspicious. What is Empty? If you are looking for either Null or an
empty string, the correct test would be:

If Len(Nz(strPasswd, vbNullString)) = 0 Then
 
K

Krzysztof Pozorek [MVP]

(...)
Is it possible to have asterisks showing in the input box rather than the
actual letters being typed?

Yes, look at this example:
http://www.access.vis.pl/af0814.htm
(The comments are in Polish, but I think that the code is understandable -
simply copy it into a standard module.)

How to call this input box with asterisks as password mask? It's easy:
TestPassw = InputPassw("Type Your password:", "Login", "???")

Kris, Poland MVP
www.access.vis.pl
 

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