Full Version: Input mask on inputbox
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
luvfuzz
Is there a way to add the password input mask (******) to an input box?

I know that I could just create a custom form...just thought I'd see if anybody knew if this is possible.
freakazeud
Hi,
yes there is...check this sample!
But creating a custom form is much easier and looks nicer.
HTH
Good luck
luvfuzz
I was sort of expecting that. Thanks for the information. Custom forms all around!
freakazeud
You're welcome.
Good luck on future projects!
wwwhitaker
Do you have an easy solution for access 97??? I'm stuck supporting & making mods to an old system. The problem I have is during a sub routine, a inputbox was used to get the user password. Problem is that it shows text typed. I tried to open a custom form, but not sure how to stop the code and wait for the user to enter the password, click enter. I planed to hide the form once enter is clicked and then refer to the data on the hidden form, but the code continues from the DoCmd.OpenForm and is already looking for the data from the form which just opened. Any ideas how to modify this without total rewrite?

OLD CODE IS:

Private Sub TSFA_Click()
Dim PassW As String
Dim user As String
Dim db As Database
Dim rec As Recordset
Dim counter
Dim x As Integer


Process_Final_Approval.SetFocus
PassW = InputBox("Please enter your Password.")

'setting variables
Set db = CurrentDb()
Set rec = db.OpenRecordset("People")
rec.MoveLast
rec.MoveFirst
counter = rec.RecordCount
x = 0

'matching password to employee name
Do Until x = counter
If rec("Password") = PassW Then
user = rec("Name")
Technical_Final_Approval.SetFocus
rec.Edit
Technical_Final_Approval = user
rec.Update
Exit Sub
End If
x = x + 1
rec.MoveNext
Loop

'what happens if password is not valid
MsgBox " Your Password was not recognized." & vbCr & vbCr & " Access Denied!", , "Invalid Password"
TSFA.SetFocus
TSFA.Value = 0

End Sub
freakazeud
Hi,
why not just split up the code?
Open your form with:

DoCmd.OpenForm "YourPasswordForm"

Then on the on click event of a button on this form use:

Dim PassW As String
Dim user As String
Dim db As Database
Dim rec As Recordset
Dim counter
Dim x As Integer

Me.Visible = False
PassW = Me.YourPasswordControl

'setting variables
Set db = CurrentDb()
Set rec = db.OpenRecordset("People")
rec.MoveLast
rec.MoveFirst
counter = rec.RecordCount
x = 0

'matching password to employee name
Do Until x = counter
If rec("Password") = PassW Then
user = rec("Name")
Technical_Final_Approval.SetFocus
rec.Edit
Technical_Final_Approval = user
rec.Update
Exit Sub
End If
x = x + 1
rec.MoveNext
Loop

'what happens if password is not valid
MsgBox " Your Password was not recognized." & vbCr & vbCr & " Access Denied!", , "Invalid Password"

HTH
Good luck
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.