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

x
?
Solved

Control Data Display By User Group

Posted on 2012-12-28
10
Medium Priority
?
336 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 2000 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

927 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