Solved

Control Data Display By User Group

Posted on 2012-12-28
10
330 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

734 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