A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How can a user's login determine which switchboard opens?



 
 
Thread Tools Display Modes
  #1  
Old April 18th, 2009, 12:21 AM posted to microsoft.public.access.tablesdbdesign
Chris v.[_2_]
external usenet poster
 
Posts: 25
Default 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  
Old April 18th, 2009, 10:39 AM posted to microsoft.public.access.tablesdbdesign
Stefan Hoffmann
external usenet poster
 
Posts: 991
Default 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  
Old April 22nd, 2009, 01:18 AM posted to microsoft.public.access.tablesdbdesign
Barry A&P[_2_]
external usenet poster
 
Posts: 119
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:52 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.