Replace Message box user input with stars *** (1 Viewer)

Alhakeem1977

Registered User.
Local time
Tomorrow, 00:41
Joined
Jun 24, 2017
Messages
308
Hi All,

I have got a db with a code to allow bypass for the super admin user but the message box views the actual password as the below screenshot.

Bypass.PNG


How can I make the Super admin user input in the message box to be replaced with stars ******* instead of the actual text password in the below code?

Code:
'** This code to allow (Bypass Key) ensures the user is the programmer needing to disable the Bypass Key  **
Private Sub bDisableBypassKey_DblClick(Cancel As Integer)
On Error GoTo Err_bDisableBypassKey_Click
    Dim strInput As String
    Dim strMsg As String
    Beep
    strMsg = "Do you want to enable the Bypass Key?" & vbCrLf & vbLf & _
             "Please key the Super admin's password to enable the Bypass Key."
    strInput = InputBox(Prompt:=strMsg, Title:="Disable Bypass Key Password")
    If strInput = "ff887788" Then '<<<<<<<<<< Type the password between the double coats "ff887788"
        SetProperties "AllowBypassKey", dbBoolean, True
        Beep
        MsgBox "The Bypass Key has been enabled." & vbCrLf & vbLf & _
               "The Shift key will allow the users to bypass the startup." & vbCrLf & vbLf & _
               "options the next time the database is opened.", _
               vbInformation, "Set Startup Properties"
    Else
        Beep
        SetProperties "AllowBypassKey", dbBoolean, False
        MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & _
               "The Bypass Key was disabled." & vbCrLf & vbLf & _
               "The Shift key will NOT allow the users to bypass the" & vbCrLf & vbLf & _
               "startup options the next time the database is opened.", _
               vbCritical, "Invalid Password"
        Exit Sub
    End If
Exit_bDisableBypassKey_Click:
    Exit Sub
Err_bDisableBypassKey_Click:
    MsgBox "bDisableBypassKey_Click", Err.Number, Err.Description
    Resume Exit_bDisableBypassKey_Click
End Sub
'** End of code for Bypass key   ***************************************************************************

Thank you in advance!
 
Hi. There's an API version of the InputBox that allows for that. Maybe try doing a search for it. If I find a link later on, I'll post it here.
 
Last edited:
Hi. There's an API version of the MessageBox that allows for that. Maybe try doing a search for it. If I find a link later on, I'll post it here.
Thanks theDBguy how fast are your replies!

Take your time.
 
I don't recall the last time I used an input mask, but if you roll your own form can you not simply use an input mask with the password property?
 
Create a small modal form instead of the input box and use the input mask as @Micron suggested.
 
Create a small modal form instead of the input box and use the input mask as @Micron suggested.
Thank you, how can I amend my code to open the form then pass the form entry to the code?
Could you do me a favor to proceed with your suggestion?
 
Thank you, how can I amend my code to open the form then pass the form entry to the code?
Could you do me a favor to proceed with your suggestion?
Use a global variable or a TempVar
 
You'd convert that double click code to simply open the new form modal. The 2 buttons you've added would either close the form or run code. The bypass code would be the OK click event button to do what the relevant part of your current code does, plus close the form when it is done. The cancel button would simply close the form without running that code. Be aware that regardless of which button is clicked, when your new input form closes the code in the event that opened the form will then continue to run because it was suspended when you opened the new form modal. That means that if you make any reference to the new form, it will error if you've closed it. You might want to first hide the new form, then get what you need from it in the calling event. Then close the new form in the event that called it in the first place.
 
Thank you so much isladogs for your help it works perfectly as I expected. :)
For anyone want's my final modifications here is my code:

Code:
'** This code to allow (Bypass Key) ensures the user is the programmer needing to disable the Bypass Key  **
Private Sub bDisableBypassKey_DblClick(Cancel As Integer)
On Error GoTo Err_bDisableBypassKey_Click
    Beep
    Dim x
    x = InputBoxDK("Do you want to enable the Bypass Key?" & vbCrLf & vbLf & _
       "Please key the Super admin's password to enable the Bypass Key.", "Disable Bypass Key Password")
   ' If x = "" Then End
    If x <> "Ff@887788" Or x = "" Then
    Beep
        SetProperties "AllowBypassKey", dbBoolean, False
        MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & _
               "The Bypass Key was disabled." & vbCrLf & vbLf & _
               "The Shift key will NOT allow the users to bypass the" & vbCrLf & vbLf & _
               "startup options the next time the database is opened.", _
               vbCritical, "Invalid Password"
        Exit Sub
        End
  End If
        SetProperties "AllowBypassKey", dbBoolean, True
        Beep
             
        MsgBox "The Bypass Key has been enabled." & vbCrLf & vbLf & _
               "The Shift key will allow the users to bypass the startup." & vbCrLf & vbLf & _
               "options the next time the database is opened.", _
               vbInformation, "Set Startup Properties"
Exit_bDisableBypassKey_Click:
    Exit Sub
Err_bDisableBypassKey_Click:
    MsgBox "bDisableBypassKey_Click", Err.Number, Err.Description
    Resume Exit_bDisableBypassKey_Click
End Sub
'** End of code for Bypass key   ***************************************************************************


Thanks again isladogs and for everyone helped me especially theDBGuy. :love:
 
Thank you so much isladogs for your help it works perfectly as I expected, for anyone want's my final modifications here is my code:

Code:
'** This code to allow (Bypass Key) ensures the user is the programmer needing to disable the Bypass Key  **
Private Sub bDisableBypassKey_DblClick(Cancel As Integer)
On Error GoTo Err_bDisableBypassKey_Click
    Beep
    Dim x
    x = InputBoxDK("Do you want to enable the Bypass Key?" & vbCrLf & vbLf & _
       "Please key the Super admin's password to enable the Bypass Key.", "Disable Bypass Key Password")
   ' If x = "" Then End
    If x <> "Ff@887788" Or x = "" Then
    Beep
        SetProperties "AllowBypassKey", dbBoolean, False
        MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & _
               "The Bypass Key was disabled." & vbCrLf & vbLf & _
               "The Shift key will NOT allow the users to bypass the" & vbCrLf & vbLf & _
               "startup options the next time the database is opened.", _
               vbCritical, "Invalid Password"
        Exit Sub
        End
  End If
        SetProperties "AllowBypassKey", dbBoolean, True
        Beep
             
        MsgBox "The Bypass Key has been enabled." & vbCrLf & vbLf & _
               "The Shift key will allow the users to bypass the startup." & vbCrLf & vbLf & _
               "options the next time the database is opened.", _
               vbInformation, "Set Startup Properties"
Exit_bDisableBypassKey_Click:
    Exit Sub
Err_bDisableBypassKey_Click:
    MsgBox "bDisableBypassKey_Click", Err.Number, Err.Description
    Resume Exit_bDisableBypassKey_Click
End Sub
'** End of code for Bypass key   ***************************************************************************


Thanks again isladogs and for everyone helped me especially theDBGuy
Hi. Glad to hear you got it sorted out. @isladogs Thanks for the assist. I bookmarked your post.
 

Users who are viewing this thread

Back
Top Bottom