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?
 

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

Similar Threads

Input box question 2
If ActiveCell has a comment then exit sub 22
Cancel Input Box error 16
Password encryption 2
How to activate InputBox Cancel Function 4
Password Prompt 1
password-protected form 9
Password on form 2

Back
Top