Password Form (1 Viewer)

T

Theman

Guest
Can anyone tell me how to create a startup form that asks for a user name and password so that the password is masked? (******)
Would this be text fields bound to table fields and what kind of coding would be required? I am not looking for anything terribly hack-proof but do want to keep unsophisticated people out. Thanks.
 

RpbertS

Registered User.
Local time
Today, 10:47
Joined
Feb 14, 2000
Messages
93
well heres an idea..pretty simple but the password is hardcoded..but anyway

create a form that has a field and a command button.
for the field code to properties then the data tab then go to the inputmask field and select password.

now on the OnClick event for the command button put this code:
Private Sub cmdpass_Click()
On Error GoTo Err_cmdpass_Click

Dim stdocname As String
Dim stlinkcriteria As String
DoCmd.SetWarnings (False)
If Me.txtpass = "PASSWORDGOESHERE" Then 'hardcoded basic password
DoCmd.Close acForm, "password form name"
stdocname = "form name to open"
DoCmd.OpenForm stdocname, , , stlinkcriteria
Else
DoCmd.Close acForm, "pass"
MsgBox "The password you entered was incorrect!" & vbCrLf & _
"Make sure you enter the correct password" & vbCrLf & _
"next time, or contact your supervisor.", vbOKOnly + vbCritical, _
"Incorrect Password"
DoCmd.Close acForm, [password form name]
End If

try that out
 
T

Theman

Guest
Hi,

Thanks for the reply. I am getting some error messages. Here is what I did. My password form is called "account," the form I want opened after correct input is called "annexations log," the text field is called text0 and the password is "annex" So:

Private Sub cmdpass_Click()
On Error GoTo Err_cmdpass_Click
Dim stdocname As String
Dim stlinkcriteria As String
DoCmd.SetWarnings (False)
If Me.Text0 = "annex" Then 'hardcoded basic password
DoCmd.close acform, "account"
stdocname = "annexations log"
DoCmd.OpenForm stdocname, , , stlinkcriteria
Else
DoCmd.close acform, "account"
MsgBox "The password you entered was incorrect!" & vbCrLf & _
"Make sure you enter the correct password" & vbCrLf & _
"next time, or contact your supervisor.", vbOKOnly + vbCritical, _
"Incorrect Password"
DoCmd.close acform, [account]
End If

End Sub

I am getting errors at the "On Error GoTo Err_cmdpass_Click" line (label not defined)

Also if an incorrect password is entered I need to have the form stay up until the correct one is entered or the operation is cancelled. Let me know what you think.
 

BarkerD

Registered User.
Local time
Today, 10:47
Joined
Dec 1, 1999
Messages
106
By entering On Error GoTo Err_cmdpass_Click, you are instructing the machine to go to that particular "label" when an error is encountered.

You need to add the line.

Err_cmdpass_Click:

'Your error handling code goes here

Duane Barker
 

Users who are viewing this thread

Top Bottom