Password input box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello.
I have a Inputbox requesting a password to the user, in the following code:

Function New_Area()
Dim pass As String
pass = InputBox("Enter de code, please.", "Password", "123")
If pass = "123" Then
DoCmd.OpenTable "Area"
Else
MsgBox "Password not valid. Please try again.", , "Password"
Exit Function
End If
End Function

My question is: the inputbox has 2 buttons: OK and Cancel, but both do the
same, I mean, If I click OK or Cancel the code runs. My goal is that if the
user click Cancel, the code is cancelled. Is it possible?

Another question is: is possible the user enter de password as ****, using
this function?

Thanks in advance for all the help.

Best regards.
 
You sure that clicking on OK and Cancel yields the same thing? Clicking on
Cancel is supposed to return a zero-length string ("")

It's not possible to mask the input with asterisks using the InputBox
function. You could try the technique I outlined in my March, 2005 "Access
Answers" column in Pinnacle Publication's "Smart Access". You can download
the column (and sample database) for free at
http://www.accessmvp.com/djsteele/SmartAccess.html

I have to ask, though: why are you prefilling the input box with the correct
password?
 
Back
Top