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

Custom Login

Status
Not open for further replies.

GenieTR

IS-IT--Management
Jan 21, 2003
28
I know there are a lot communication on this topic with security. All I want is a simply login screen that works with the switchboard menu. When a user login, depending on the access, it will either enable or disable buttons on the switchboard. For example in the staff table there is admin and guest accesses. The admin is for the person that is entering data into the database, and guest access is for viewing and printing reports. So when the user logs in as admin the Add button will be enable, whereas, guest the Add button is disable.

The switchboard menu was generated through the wizard. I am new to VBA and I do not know how to tie the login screen with the switchboard.

PS I have already created the login screen.

Thanks in advance
 
Create a table called Employee Access;

Username
Button

In this table, add records for each user with the buttons they can access.

For example;
Username Button
1234 Add
1234 Delete
1234 Search
1111 Search

If you have an employee form, create a subform for it using the Employee Access table as it's recordsource, link by the Username so that for each employee you will see their button access info.

You can create a table with the button names in it, and use it for the rowsource for the subform.

Once you have records in the Employee Access table, on the load of the form with the buttons, you can check if they have access or not.

On the On Load event, code something like this;

If not isnull(dlookup("[Username]","Employee Access","[Button] = 'Add'")) then
Me![Add].Enabled = True
Else
Me![Add].Enabled = False
End If

Do this for all buttons on the form.

Happy coding! Anthony J. DeSalvo
President - ScottTech Software
"Integrating Technology with Business"
 
I did not want to create a whole menu system, I wanted to use the switchboard menu. I have two tables which are staff table and the switchboard table.

If it is a problem, then I will have to create those custom menus.
 
That's okay, you can still use the same paradigm as I posted earlier.

Look up the user's access rights on the load of the switchboard, then enable or disable the button absed on the rights.

Sub SwitchBoard_Load

If DLookUp("[Access Rights]","Staff Table","[Staff] = '" & Forms![Login]![Staff] & "'") = "Admin" then
Me![Add].Enabled = True
Else
Me![Add].Enabled = False
End If

End Sub Anthony J. DeSalvo
President - ScottTech Software
"Integrating Technology with Business"
 
Due to the nature of the switchboard code, when I implemented the code, I am receiving an error message, since the switchboard code does a filloption function.

 
What if you wanted to give/restrict access to certain forms instead of buttons? how would you do this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top