Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > Forums > Access
Back to Access Forum    Comments List
Permissions controlled from a Upload Images   Link   Email  
Jorge Restrepo      
4 months ago
Hi,  from security seminar learned how to have users belong to User Groups, and control their permissions to open specific forms or reports.  This is done by subs like:
Private Sub FormBtn_Click()
    If IsUserInGroup(1) Or IsUserInGroup(2) Or IsUserInGroup(3) Then
        DoCmd.OpenForm "FormF"
    Else
        MsgBox "No Authorized"
    End If
End Sub
But when there are many forms or reports this becomes cumbersome.  Is there a way to control permissions from a single table that contains the names of all Forms or Reports as well as usergroups, etc. ?
Thanks,
Adam Schwanz             
4 months ago
Technically, I suppose you could create some kind of function that could take variables and create a line of executable code.

But creating that function would be WAY more advanced and work than just doing it like the video and copy/pasting your isUserInGroup code around. Not to mention, you are still going to need to code all the buttons that you use to call for that function and send it the variables (form names, actions (opening forms, setting properties, etc.)) which is going to be even more then you have to do now.

So yea it's probably possible, but it wouldn't be easier. I would just keep using it how you have been.
Jorge Restrepo      
4 months ago
Adam, thanks for your response. Sorry I accidentally posted in the wrong place.
Kevin Yip        
4 months ago
There is no "global handler" of this kind of thing so you need to write code for everything everywhere.  You can save time by making the code really short.  E.g.:

Private Sub Form_Open(Cancel As Integer)
    Cancel = Not AU(CurrUserID)
End Sub

The form above won't open if the custom function AU() returns false.  AU() determines if the current user (identified by global variable CurrUserID) is an authorized user or not.  Then you copy this one line of code to every form and report.  Users can't open these forms and reports even on the navigation pane if they are not authorized.

Sami Shamma               
4 months ago
Kevin
Like usual, very elegant solution.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/27/2024 1:44:45 AM. PLT: 1s