Solved

Control Data Display By User Group

Posted on 2012-12-28
10
295 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
 
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
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

746 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now