Switchboard button ?'s (1 Viewer)

beckie1234

Struggling Student
Local time
Yesterday, 20:36
Joined
Mar 10, 2007
Messages
94
I created a switchboard that allows the user to pull up a data entry form, a form that produces reports, and a form that allows the user to open table update forms. I want to put a password on the table update button so not everyone can get in to change the items in the tables. I am assuming it would be in the on_click event but I am not sure how to go about this. All suggestions would be great. :)
 

Fifty2One

Legend in my own mind
Local time
Yesterday, 20:36
Joined
Oct 31, 2006
Messages
1,412
I have made a table to contain each persons signin name and their sphere of responsibilities. If you use this table to base your frmMenu then you can place in the OnLoad event

If me.sphere = "Controller" then
me.Command12.Visible = True
me.Command14.Visible = True
me.Command16.Visible = False
Else
me.Command12.Visible = False
me.Command14.Visible = False
me.Command16.Visible = True
Endif


You can always set all the buttons except QuitApplication as default to False as a default so someone will call if they see nothing but an exit sign...
 

beckie1234

Struggling Student
Local time
Yesterday, 20:36
Joined
Mar 10, 2007
Messages
94
On_Load event of the form when the user clicks the button?
 

boblarson

Smeghead
Local time
Yesterday, 20:36
Joined
Jan 12, 2001
Messages
32,059
I have a database that I do something similar with. I have it set so that there is a users table and it houses their network login name and the security level that they have. I have the table hidden and I'm using an MDE with Access runtime so they don't have access to the tables, but this situation doesn't need to be real secure so it's simplified like that.

Then, when they go to do anything that I want protected, it calls a function that checks their userid in the table and brings back the access level. If it is at a certain level I let the code go on, if not they are told via a message box that they don't have the appropriate rights to do this action and to contact me if they feel otherwise.
 

Fifty2One

Legend in my own mind
Local time
Yesterday, 20:36
Joined
Oct 31, 2006
Messages
1,412
In vb me.Command12.Visible = True will allow you to see the button, me.Command12.Visible = False hides the button - the end user can not click what they can not see so if you put it in the onload then they dont see the button if it is false or they see it if it is true...


...hope that makes sense
 

boblarson

Smeghead
Local time
Yesterday, 20:36
Joined
Jan 12, 2001
Messages
32,059
... me.Command12.Visible ...
And just a suggestion to Beckie, if you haven't already done it -- make sure to rename your controls to something meaningful and I suggest using the naming convention of cmdYourButtonNameHere (or btnYourButtonNameHere) for command buttons, txt as the prefix for text box names, lst for list boxes, frm for forms, etc.

It saves you a ton of time later when you are trying to figure out what each thing is and you can spot it right away when it is meaningful.
 

beckie1234

Struggling Student
Local time
Yesterday, 20:36
Joined
Mar 10, 2007
Messages
94
Thanks. This is a capstone project for school so I have to follow naming conventions. I am working on getting this code to work. I will check back with questions. The first thing I am confused about is where is all this code going? Can I set it to have just one password that when the user first clicks the button
a form opens asking for this password and then if the user types in the correct password the form I am trying to protect will open. Only people who need to access this will have this password.

Does that make sense?
 

boblarson

Smeghead
Local time
Yesterday, 20:36
Joined
Jan 12, 2001
Messages
32,059
Quick question to you. Will the users all be logged in on the same computer? Or will more than one person be using the same computer to get into this?

If not, then the idea I suggested about checking their NT account login when they open the database would be simplest as they would not need a password. but, if you wanted one, you can hardcode or use a table for storing the password. There are really myriad ways of doing this.
 

beckie1234

Struggling Student
Local time
Yesterday, 20:36
Joined
Mar 10, 2007
Messages
94
I think I am working more towards hard coding for now and the users that are allowed to access it will have the password. I hadn't considered this running over a network, but it is something I should consider.

Do you have a sample of how the table would look if it is storing for several people and how i would set the table to make sure the user is ok'd to have access?

I am attaching what i have so far since I have cleaned it up, but it still has a few bugs.

When the switchboard opens you will see the button I am talking about. (hopefully) the one to update tables.

That is the one I am trying to protect.

I think I am trying to make this to simple.
 

Attachments

  • sampleDB.zip
    158.6 KB · Views: 109

Users who are viewing this thread

Top Bottom