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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Switchboard with Password Protected on Some Options 1

Status
Not open for further replies.

Tamrak

MIS
Jan 18, 2001
213
US
Hello all,

Is there anyway we can design a form, using Switchboard Manager, with one of the seven options having password protected?

What I did was creating a form-> using a Switchboard Manager in Access 2000. I created seven options in the main Switchboard. Let call it "Switchboard1." All users can access to all options on this Switchboard1. However, I would like to have my option # 6 to be password protected.

Do I need any command/code for this? I do not need a code to be an authorized user, just a simple password should be enough. Let say, I would like a password to be "yankee."

The process will be: when a user clicks a button, option # 6, the menu will pop-up and ask for a password. If a password is correct, the program will open another switchboard, let say it is called Switchboard2. Switchboard2 menu was designed in the Switchboard Manager program. There are 5 options in Switchboard2.

For option # 1 to # 5 and # 7, any user can go in there.

All of your helps will be very much appreciated. Thank you.



 
Here is a quick way:
=====

1) In a blank module, put the following:

Public Const gstrPWD As String = "yankee"

2) Close and save the module as modPublics

3) On your form (in design view) click on the button you wish to password protect, and go the properties window on the "Event" tab, you should see something like this:

=HandleButtonClick(6)

3) Delete it
4) Click on the elipse button (...) and select Code Builder
5) Now you should see something like this

Private Sub Option6_Click()

End Sub

4) Make it look like this:

Private Sub Option6_Click()
If InputBox("Please Enter Password") = strPWD Then
Call HandleButtonClick(6)
Else
MsgBox "You do not have proper security to continue"
End If
End Sub

=====
Now to change your password, open your module and change the public constant.

This method presents two problems (don't know if they will be issues for you or not):

1) If somebody gets into the database and opens the module, they can find the password.
2) When a user types data into an input box, it is not masked. The letters can be seen, they do not show up in password masking (*****).

The second one can be solved by creating a form and using it instead of an input box. Let us know if you need something different. Jim Lunde
compugeeks@hotmail.com
Custom Application Development
 
Hello Jim,

I tried putting on your code. Yes, the password prompted popped up. However, I encountered two problems:

1. Even though I input the correct password and click OK, I still received an error message "you do not have proper security to continue.

2. When the popped up came out blank, if I hit
either "OK" or "Cancel" without having to supply any password, Switchboard2 came out. Switchboard2 should not come out.

Any other suggestions? I feel that we are in the right direction. Thanks again.

 
I tried in on my computer before I posted, and it worked fine.

Did you copy and paste the code from the above post?
It sounds like it is working opposite of what you want, correct?

Above, your number 1 should happen in the number two condition, and visa versa.

It's like the If statement is swapped. Can you post your code?
Jim Lunde
compugeeks@hotmail.com
Custom Application Development
 
Hi Jim,

I will create a simple database later and test the code again. I used the database that contains the real data and several codes in there.

However,I did what you posted.

1. I created another module and name it. That module has only two lines. The line above is "Option Compare Database."

2. It is not working opposite from what I want. I feel that the code is going to the right direction.

Since I has only one Switchboard Master Form, I do not think I can have more than one Master form, can I?

I will let you know. Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top