Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to password protect a certain button of the switchboard

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I was just wondering if anyone could help me in trying to password protect a button that opens another form of a switchboard. I would also like the option to change the password if a certain button is clicked as long as they know the old password. Is this possible...? Please HELP!

I'm Lost... X-)
 
I call a simple dialog box that prompts for a password.

If the password is incorrect then the dialog returns to the switchboard.

If it is correct then the dialog calls whatever you want it to. as long as the user's don't have a back door method (i.e. database window) to get past then you should be OK.

The option does show on the switchboard but if a normal user who doesn't know the password click it then they can't get any further.

Peter

 
Dataside,

How did you call the dialog box prompting for a password and how did it check for validity?
 
bocceman,

This is how I did it with my Db Administrator Form. I created a log in form with an unbound control named "Password". I then created a command button on that form with the following macro set to on click. The structure of the conditional macro that looks like this:

Condition Action
[Forms]![frmLogin]![Password]="yourpassword here" openform
[Forms]![frmLogin]![Password]<>&quot;yourpassword here&quot; cancel event
... MsgBox

The first action opens the specific form (DB admin Form for me) if the password entered matches the one you have set. The second action will cancel the event of opening the form if the password entered is not (<>) what you have set and the third event will create a message box informing the user that the password is incorrect and to go back and re-enter their password.

One final note, I know this isn't the most secure method but it works for me mainly because I make the login form, the admin form, and macro &quot;hidden objects&quot; and on the options menu un-check &quot;show hidden objects&quot;. In my db's I do not allow users to see anything other than switchboards, forms and reports.

Let me know if this makes sense... It's kinda my fuzzy logic working at its best!

Andy
 
I do pretty much what jabrony76 suggested, except I take it a step further. I set up a simple secure table with a text field called username. I then enter the user's passwords in that table. Then in the OK command button of my login form, I have code like this to validate the entry:
Code:
If IsNull(strX = DLookup(&quot;[username]&quot;, &quot;users&quot;, &quot;[username] = '&quot; _
    & Forms!frmLogin!TxtLogin & &quot;'&quot;)) Then
  strMsg = &quot;Invalid Username Entered, Please Retry&quot;
  MsgBox strMsg, vbOKOnly + vbExclamation
  Forms!frmLogin!TxtLogin = &quot;&quot;
  Forms!frmLogin!TxtLogin.SetFocus
  ......
  ...... 
  etc....

As an added extra, set the format of the login text field to Password so that the user only sees asterisks...
 
Jabrony76:

I tried your way of setting up the macro with the OpenForm action and contdition if the password is correct. I'm not sure how you set up the CancelEvent's condition where textbox <> &quot;YourPassword&quot;. There is not an arguement for CancelEvent as I can determine. Is this condition stated in the OpenForm action after the = &quot;YourPassword&quot; statement?
Please inform.

Thanks,
B-Man
 
bocce,

&quot;Cancel Event&quot; is one of the choices from the &quot;Action&quot; drop down box of the macro. I know its available in Access 97 and 2000.

The first line of the macro should read:
[Forms]![frmLogin]![Password]=&quot;yourpassword here&quot; - this is the condition
openform - this is the action

The second line of the macro should read:
[Forms]![frmLogin]![Password]\<>&quot;yourpassword here&quot; - this is the condition
cancelevent - this is the action

The third line of the macro should read:
... - this is the condition
msgbox - this is the action

Let me know if this works for you.
Andy
 
Andy,

FYI: I had to switch up the order of the events in order for things not to show up when they did (Msgbox)

1)[Forms]![frmLogin]![Password]<>&quot;yourpassword here&quot; - cancelevent - this is the action

2)[Forms]![frmLogin]![Password]<>&quot;yourpassword here&quot; - - this is the condition
msgbox - this is the action

3)[Forms]![frmLogin]![Password]=&quot;yourpassword here&quot; - this is the condition
openform - this is the action

Thanks for your advice.

B-Man
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top