Solved

Control Data Display By User Group

Posted on 2012-12-28
10
312 Views
Last Modified: 2013-01-02
Greetings, I am seeking a working example of how to control the viewing of data by different user groups.  For example, I have 4 organizations who each place data into a shared Access database.  I do not want want organization 1 to be able to view organization 2/3/4 data.  I would like to have a sleek, friendly interface form for my organizations to each enter 10 items (things like bio, status, description, or just items 1-10) but not be able to view each other's records.  I need a working example so I can emulate best practices when I build my own.

A solution using VB.NET & SQL would be preferred, but MS Access is the next best thing.
0
Comment
Question by:GenericCog
  • 6
  • 3
10 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38727649
How good are you at VBA...?
Do you already have a login system in place that identifies the Users Group?

In a nutshell, the use logs on, and the "Group" is stored in a global variable
Then create a function to retrieve this value.
Then all forms and Reports have a recordsource that filters for only that group.
SELECT *
FROM YourTable
WHERE GroupID=GetGroupID()
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38727656
<I need a working example so I can emulate best practices when I build my own.>
Why not post what you have so far?
Instead of forcing us to create a working example from scratch?
...and "guessing" about all of the aspects of your current database...?
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 38727714
Besides, there really cannot be a hard defined "Best Practice", until you tell us your very specific needs:
Security?
Preferred filtering method?
Skill level?
Current Design?
...etc

I can think of at least three different ways to approach this, ...all following a different set of "Best Practices"

Here is a very basic example

;-)

JeffCoachman
Database6.accdb
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38727732
...and this is a mod to insert the Group into all new records
Set the default value property of the Group control to the function:  GetGroup()

I am sure you can examine this db completely and see what was done here.

;-)

JeffCoachman
Database6.accdb
0
 

Author Comment

by:GenericCog
ID: 38727843
Jeff,  Thanks for the quick response!!  I'm looking at your example files right now.  I'm familiar with VBA to the extent that I can write beginner level code.  I'm comfortable with VB.NET.

I do not have anything for you to work from.  I'm trying to meet the need of a future requirement.  I was hoping I could see what the community already had in their bag before I try and reinvent the wheel.  :-)
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38727892
OK, keep me posted
0
 
LVL 21

Expert Comment

by:Alpesh Patel
ID: 38734059
Enter that UserGRoup in Table and Filter data based in Logged in user's usergroup
0
 

Author Closing Comment

by:GenericCog
ID: 38736907
Jeff, I was able to completely understand this example and am in the process of building my own based on yours.  Thanks!!!
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38737544
;-)

BTW if you are wondering why I use the function instead of the variable (to filter the form), ...it is because you can use the function anywhere (like in a query)
(You can use a function for query criteria directly, but not a code variable)
SELECT *
FROM YourTable
WHERE Group=GetGroup()

Also at some point the function can be modified to include validation, and.or other arguments.

;-)

Jeff
0
 

Author Comment

by:GenericCog
ID: 38737731
AH!!!!!  I was not sure about that... somewhere in the back of my mind I figured there would be a reason.  Thank you so much for your help on this!!!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question