If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How can a user's login determine which switchboard opens?
Please advise me if this is not the best way to accomplish the desired
result. I am new to Access and have very limited programming experience. I'm creating a split database. There will be several users with different permissions to use the database: 1) View ONLY, 2) Enter data using only a FEW fomrs, 3) Enter/Edit any data using forms, and 4) Administrator (Full Access to create new queries/forms and edit tables if necessary). I would like the users to log on the the database as the agency only uses a file server (this will hold the back-end, and I will install the front-end along with Access runtime on the local boxes). I'm thinking that there could be a switchboard for each permission level, which would load after a log-in form is completed. The different switchboards would all be copies of the main switchboard, but with comand buttons disabled (and grayed) per users access to the database. So I have 2 questions: 1) Is this a workable plan and 2) How do I load the correct Switchboard once log-in is completed? I've only used macro's so far (I have no VB experience). |
#2
|
|||
|
|||
How can a user's login determine which switchboard opens?
hi Chris,
Chris v. wrote: So I have 2 questions: 1) Is this a workable plan and 2) How do I load the correct Switchboard once log-in is completed? I've only used macro's so far (I have no VB experience). 1) Yes, you may go this way. But keep in mind, that a "power" user can bypass these measures. 2) You need a table holding the users and their passwords (better encrypted passwords or hashes) for the login. Add a field for the access level using fixed lookup values. Simply name your switchboards after them, e.g. Switchboard_ReadOnly Switchboard_.. Switchboard_Administrator Then you may use something like this for your login form: Private Sub cmdLogin_Click() Dim AccessLevel As Variant Dim Condition As String Dim Password As String Dim Username As String Password = "'" & Replace(Nz(txtPassword.Value, ""), "'", "''") & "'" Username = "'" & Replace(Nz(txtUsername.Value, ""), "'", "''") & "'" Condition = "Username = " & Username & " AND Password = " & Password" AccessLevel = DLookup("AccessLevel", "User", Condition) If IsNull(AccessLevel) Then MsgBox "Wrong credentials." Else DoCmd.OpenForm "Switchboard_" & AccessLevel DoCmd.Close acForm, Me.Name End If End Sub mfG -- stefan -- |
#3
|
|||
|
|||
How can a user's login determine which switchboard opens?
Chris
Here is a little youtube Tutorial that shows how to do the user logon although the suggestion stefan made with the table seems like the best route.. http://www.youtube.com/watch?v=pT2boGE-bAg There are a few other videos by the same poster that add a little more functionality to the logon form.. Barry "Stefan Hoffmann" wrote: hi Chris, Chris v. wrote: So I have 2 questions: 1) Is this a workable plan and 2) How do I load the correct Switchboard once log-in is completed? I've only used macro's so far (I have no VB experience). 1) Yes, you may go this way. But keep in mind, that a "power" user can bypass these measures. 2) You need a table holding the users and their passwords (better encrypted passwords or hashes) for the login. Add a field for the access level using fixed lookup values. Simply name your switchboards after them, e.g. Switchboard_ReadOnly Switchboard_.. Switchboard_Administrator Then you may use something like this for your login form: Private Sub cmdLogin_Click() Dim AccessLevel As Variant Dim Condition As String Dim Password As String Dim Username As String Password = "'" & Replace(Nz(txtPassword.Value, ""), "'", "''") & "'" Username = "'" & Replace(Nz(txtUsername.Value, ""), "'", "''") & "'" Condition = "Username = " & Username & " AND Password = " & Password" AccessLevel = DLookup("AccessLevel", "User", Condition) If IsNull(AccessLevel) Then MsgBox "Wrong credentials." Else DoCmd.OpenForm "Switchboard_" & AccessLevel DoCmd.Close acForm, Me.Name End If End Sub mfG -- stefan -- |
Thread Tools | |
Display Modes | |
|
|