How to Mask Password Input

Buns1976

Board Regular
Joined
Feb 11, 2019
Messages
194
Office Version
  1. 365
Platform
  1. Windows
Hi Everyone,

The code below is on a button which opens a table when the password is entered. I need to mask the password
as it is being typed in the dialog box if someone could help me with that please.

Thank you!

Code:
Private Sub Command58_Click()



'Attached to On Click event of cmdOpenDepartmentTable


    Dim strPasswd


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


    'Check to see if there is any entry made to input box, or if
    'cancel button is pressed. If no entry made then exit sub.


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


    'If correct password is entered open Departments table
    'If incorrect password entered give message and exit sub


    If strPasswd = "DSR" Then
        DoCmd.OpenTable "Departments", acNormal
        


    Else
        MsgBox "Sorry, you do not have access to this form", _
               vbOKOnly, "Important Information"
        Exit Sub
    End If
End Sub
 
Last edited:

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
That's difficult to do with an Inputbox, you'd be better of using a userform.
You can set the PasswordChar property of a textbox so that it masks the input
 
Last edited:
Upvote 0
That's difficult to do with an Inputbox, you'd be better of using a userform.
Fluff, are you talking about Excel or Access?
The use of the word "userform" seems to imply you might be talking about Excel, but the question is posted in the Access forum (where the nomenclature would just be "Form").
 
Upvote 0
Oops,hadn't noticed this was in the Access forum
 
Upvote 0
I have done this in Access with userforms created in VBE.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top