Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 158
  • Last Modified:

Design question

Hello. I need to design an app that will allow different users access to different objects. Upon users Login program should know what he / she can access. Certain users will be able to modify data others will just be able to view it. How can i allow this ? Data is stored in Access. Please suggest . Thank  you.
0
vbRetard
Asked:
vbRetard
1 Solution
 
FoyalCommented:
Add a table for the users with an access code field, then when your program runs verify each process according to this access code.

i.e.:

Option Explicit

Dim intUserCode As Integer
Const FULL_ACCESS = 5

Private Sub Form_Load()
   
    frmLogin.Show vbModal, Me

    'load the user code from the
    'database based on the user name
    intUserCode = GetUserCode(UserName)

End Sub    

Private Function GetUserCode(S As String) As Integer
     
    'your code to get the code...

End Function

Private Sub cmdAdd_Click()
   
    'if the user isn't qualified then
    'show a message and exit the sub
    If intUserCode < FULL_ACCESS Then
        MsgBox "Access Denied"
        Exit Sub
    End If
   
    'otherwise, do whatever you
    'need to do...

End Sub

0
 
arikkaCommented:
Below is brief description of a good design and Microsoft recommendation ...

Your application is 3-tier should be  
3 tier application.  

1. Presentation VB code;
2. Business Logic components
3. Data Components - access DB

Use MTS as components placeholder, so
BL components and Data Components put
in MTS. Use MTS role base security to
restrict access to Data Components specific users or users groups.
0
 
vbRetardAuthor Commented:
MTS is a bit too advanced for me right now. I need something simpler. To create a class object which can do something like this. I don't need anyone post the code just ideas on how i can validate or lock different portions of the program to the person who shouldn't have access to it.
0
 
gcs001Commented:
Foyal's suggestion is a good one.
0
 
FoyalCommented:
Thanks for the point.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now