Restricting user to access certain forms/reports

BPBP

Registered User.
Local time
Today, 08:47
Joined
Feb 27, 2009
Messages
64
On my mainswitch board, i have some buttons to access certain forms or reports.
Is there anyway i can put in restriction such as on click, enter a password, if correct then allow form/report to open, else deny entry.?
 
Nowadays I make my own password forms so the password enters as "*" and etc. Which may suit your needs better, but this one uses an inputbox to get the password:

Dim stDocName As String
Dim stLinkCriteria As String
Dim password As String
Const VALIDPASSWORD As String = "2ez4me"


password = InputBox("Please enter your administrative password now:", "Password Prompt")

If password = VALIDPASSWORD Then
stDocName = "frmAddUnit"
DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria
Else
MsgBox "The password you entered was incorrect, you may not enter this section. Please contact the database administrator.", , "Login Error"
End If

This can also be adapted if you wish to make your own password form with the * password. You can open the password form and pass along the form they're trying to open using OpenArgs. If the password is correct, it opens the form they were initially trying to open, if not, it sends them back to your switchboard.

You may also find it better to make your mainform an unbound form with buttons that opens forms, than an actual switchboard made by MS Access.
 
Can you explain what it means by password enters as "*"?
ANd maybe more detail on making the password form with the * password part. Thanks.

If the password displays as ****** when entering it has better security since nobody can see it. Is that what you meant?

my main form is just an unbound form with buttons. was too used to calling it switchboard.


Nowadays I make my own password forms so the password enters as "*" and etc. Which may suit your needs better, but this one uses an inputbox to get the password:

Dim stDocName As String
Dim stLinkCriteria As String
Dim password As String
Const VALIDPASSWORD As String = "2ez4me"


password = InputBox("Please enter your administrative password now:", "Password Prompt")

If password = VALIDPASSWORD Then
stDocName = "frmAddUnit"
DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria
Else
MsgBox "The password you entered was incorrect, you may not enter this section. Please contact the database administrator.", , "Login Error"
End If

This can also be adapted if you wish to make your own password form with the * password. You can open the password form and pass along the form they're trying to open using OpenArgs. If the password is correct, it opens the form they were initially trying to open, if not, it sends them back to your switchboard.

You may also find it better to make your mainform an unbound form with buttons that opens forms, than an actual switchboard made by MS Access.
 
Hello,

Yes I did mean the *'s as blocking what is typed in for security reasons.

Create a form called frmPassword that has a field for the password, and a continue button.

From the main menu, each button will open the frmPassword, but have the open arguements passed to the frmPassword set as the form that they should be allowed to ultimately open. For example:

Button1 has:

stDocName = "frmPassword"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , , "Form1"

Button 2 has:

stDocName = "frmPassword"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , , "Form2"

Then the password form has the following code:

stDocName = Me.OpenArgs

If Me.txtPassword = "2ez4me" Then
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
MsgBox "Wrong Password"
End If

Attached is an example database that demonstrates how this works.
 

Attachments

Hi,
On a very similar note, I have a form for the logon id and password of users, and the Input Mask is set to 'Password' so all letters typed are displayed as *'s.
What I was wondering was, is there a way to display the letter for a brief second before replacing it with the *? (Just like on my phone!) :D

Thanks.
 

Users who are viewing this thread

Back
Top Bottom