473,404 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

how to create different levels of access(workgroups) with different access security

Level User Acces


hey guys! i need help! look this:

i need to know better idea to implement in the system, "User Access level". i begin , creating groups where exists a "admins" and "operators" users. admins choosen the forms each user can access. sometimes, any user can access a screen but not access all controls in this form. how can i do to create access a level about controls?? please, help me.
Apr 3 '13 #1
5 1421
zmbd
5,501 Expert Mod 4TB
There are several ways of doing this; however, the one I tend to use is the tag property of the control.

Within this property I either use a flaging scheme or even just a simple list. So in the case you've given, say, "Admin," and "User." So say all of the controls will have "Admin" in this property as the admin should have access to everything on the form; however, only a few will have "User" in the property.

So in the on open or on load event, I pull the group information from the table about the current user and then loop thru the controls on the form to see if it should be unlocked.

That's more than likely the simplest method.
Apr 4 '13 #2
ZMDB thanks alot for your reply.But am ashamed to say that i am completely lost.ZMBD you are an advanced programmer and what seems easy to us novice programmers is hell.I would appreciate it if you explain to me like a std two child on how to use the flaggin scheme or simple list in conjuction with the tag property,thanks alot.
Apr 8 '13 #3
zmbd
5,501 Expert Mod 4TB
kibokoyao:
My apologies for the delay, I've a major project in the lab and visitors from other locations; thus, a lot of "fires" to handle. - I call it "job security!"

As we work thru this, please keep in mind that Bytes is not a code writing service. Instead we try to help each other thru a rough spot or to get back on the right path. :)

For this basic example:
1) For a simple set of groups, say "admin," "Spvsr," "Lead," and "User"
2) Form named "zfrmAlpha"
3) control on form, text box, named "zctrltxtAllowSome" that well let most people use.
control on form, text box, named "zctrltxtAllowAdmin" that only the admin can use.

Open your form in design view.
Right click on your control and select "properties" in the popup menu.
Select the "Other" tab in the properties.
In the list you will see a field named "Tag" (your it! ;-) ) this is where we'll use the group names (or the flags but that's much more complicated)

So in our example:
[zctrltxtAllowSome].[Tag] we will enter as a string:
"admin", "Spvsr", "Lead", "User"

[zctrltxtAllowAdmin].[Tag] we will enter as a string:
"admin"

You would do this for every control that you want to control user level access to.

Do not close; however, save your form.

Now before we go into the code, please read the thru the following... especially the first section:> Before Posting (VBA or SQL) Code You need to understand how the Options work and the basic troubleshooting.


Now goto the "Event" tab of your form's property, the easy way to do this: Look at the property dialog, in the upper left corner is a drop down box, it should currently show the name of the control you're on (in our example, [zctrltxtAllowSome] or [zctrltxtAllowAdmin]) select the word "Form" in this box. You are now in the form's properties - click onthe "Event" tab.

Now look down this list, there will be one labeled "On Open" this is the very first event that "fires" when a form is opened, so click in the empty are for this field, you should see a dropdown arrow and a [...] button... click on the [...] and select "Code Builder"

The VBA editor will now open and you will get a blank:

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Private Sub Form_Open(Cancel As Integer)
  5.  
  6. End Sub
  7.  
From here, you will need to define a few variables to hold the user name, security group, and a pointer to the form (in our example "zfrmAlpha"
I can't tell you how to get the user name. This depends entirely on how you've set your login forms. Then I'd dlookup() to get the security group which for single hits is not too bad to use from a performance consideration.

Now that you have your security group, you would do a For Each ctrlitem in zfrmAlpha.controls to loop thru each control on the form, full the control's tag property, and do an instr compare aganst te return and unlock the control otherwise, so an "Admin" would be found in
[zctrltxtAllowSome] and in [zctrltxtAllowAdmin] ; however, "User" would only be found in [zctrltxtAllowSome].


Ok, back to the lab ;)
Apr 9 '13 #4
ZMBD thank you for your reply,i followed you till here...
From here, you will need to define a few variables to hold the user name, security group, and a pointer to the form (in our example "zfrmAlpha"
I can't tell you how to get the user name. This depends entirely on how you've set your login forms. Then I'd dlookup() to get the security group which for single hits is not too bad to use from a performance consideration.

Now that you have your security group, you would do a For Each ctrlitem in zfrmAlpha.controls to loop thru each control on the form, full the control's tag property, and do an instr compare aganst te return and unlock the control otherwise, so an "Admin" would be found in
[zctrltxtAllowSome] and in [zctrltxtAllowAdmin] ; however, "User" would only be found in [zctrltxtAllowSome].

ZMBD excuse my ignorance but would pliz appreciate it alot if you tackle the following and help me out by giving example in your own terms on how to develop them
A)ZMBD define a few variables to hold the 1.user name, 2.security group, and 3.a pointer to the form (in our example "zfrmAlpha"
B)ZMBD give me an example on how to set up a login form so that we are able to get a user name which will be used in your example.
C)Now you can show me how to dlookup() to get the security group which for single hits is not too bad to use from a performance consideration.
D)Now after getting the security group you can help through an example on how to do a For Each ctrlitem in zfrmAlpha.controls to loop thru each control on the form, full the control's tag property, and do an instr compare aganst te return and unlock the control otherwise, so an "Admin" would be found in
[zctrltxtAllowSome] and in [zctrltxtAllowAdmin] ; however, "User" would only be found in [zctrltxtAllowSome].

NB:SORRY FOR INVOLVONG YOU IS SUCH A LENGTHY DISCUSSION BUT ZMBD I KNOW THAT YOU KNOW THIS IS A COMPLEX AND CHALLANGING TOPIC AND TO SOMEONE LIKE ME WHO IS JUST STARTING OUT PROGRAMMING IN VB/ACCESS IS VERY VERY HARD,ZMBD BY HELPING ME YOU ARE ALSO HELPING A COMMUNITY,THANKS ALOT.
Apr 12 '13 #5
zmbd
5,501 Expert Mod 4TB
@kibokoyao
A)ZMBD define a few variables to hold the 1.user name, 2.security group, and 3.a pointer to the form (in our example "zfrmAlpha"
What I mean by this is the “basic” declaration of the program variables using the
Dim (variablename) AS (type) construct. This is a fundamental skill in any programming language.
Please understand, in order to accomplish your goal, you will need at least a moderate understanding of the VBA programing language. This is not something we can cover within this forum; however, there are several good VBA tutorial sites available.

B)ZMBD give me an example on how to set up a login form so that we are able to get a user name which will be used in your example.
You can find a dozen examples on the internet. The simplest will involve a form, two text boxes (one with the “password” format” and a few command buttons. You will either need to leave this form open and hidden, create a “class module” and instance the user (somewhat advanced), or create a global static variable.

You can also use something like: Function to return Username (NT Login) of current user to return the currently logged in windows user which is something I do quite often as my lab is domain networked.

As I pointed out in my first reply, Bytes is not a code writing service. If you have a form that is giving you a problem, then we can help with that specific issue – more than likely within a new thread.
C)Now you can show me how to dlookup() to get the security group which for single hits is not too bad to use from a performance consideration.
In your VBA editor, type the dlookup() function within a sub and press [F1] you will get the help file covering the basics. My advice here is that where the help file and many other sources will show to build the criteria string “inline” with the function I suggest that the string be constructed using a string variable first and the variable inserted into the function. This will make troubleshooting the criteria string much easier.
D)Now after getting the security group you can help through an example on how to do a For Each ctrlitem in zfrmAlpha.controls to loop thru each control on the form, full the control's tag property, and do an instr compare aganst te return and unlock the control otherwise, so an "Admin" would be found in
[zctrltxtAllowSome] and in [zctrltxtAllowAdmin] ; however, "User" would only be found in [zctrltxtAllowSome].
Once again, here you need a least a moderate understanding of the VBA programing language. The For-Each construct (once again, you can type "FOR" in a VBA editor, select the word, press [F1] and look at the basic help file) steps thru each member of a given collection, in this case, we'll be using the form's controls collection. The construct we would be using in this example will look at the tag property each control one at a time. We would then use the string functions to look for the given value within the control's tag property.

NB:SORRY FOR INVOLVONG YOU IS SUCH A LENGTHY DISCUSSION BUT ZMBD I KNOW THAT YOU KNOW THIS IS A COMPLEX AND CHALLANGING TOPIC AND TO SOMEONE LIKE ME WHO IS JUST STARTING OUT PROGRAMMING IN VB/ACCESS IS VERY VERY HARD,
Yes, this is a fairly complex bit of coding and is a challenge to even some of the better code writers. Here you make it very clear that you are just “starting out” in programming VBA for Access. Unfortunately, the project you chose to “cut your teeth with” is somewhat more complex than many you could have undertaken.
You absolutely must have the basics of programing mastered before you can hope to take something like this on.
  1. You need to sit down and write in no more than one paragraph, with complete sentences, a description of your problem/goal.
  2. You need to list the general information required to solve your problem, or reach your goal, such as “Company Name” or “Part Number”, etc… (sounds like you may already have this).
  3. You need a basic flow chart of the steps needed to complete the task. I prefer Nassi-Shneiderman charts ( Yoder-Schrag-nassi_schart.pdf ) One reason I like this charting method is that you can start out with plain English and then easily convert to just about any structured code of your choice. I’ve even used this method to teach chemical analysis of compounds!
  4. You need to have a basic mastery of the programming language, in your case, VBA. There are many tutorial sites on the net for VBA. IMHO, some far better than others; however, such a statement is purely my opinion based upon how I learn. You will need to find one that you can understand and learn from – which may well be different than what I would choose.
“ ZMBD BY HELPING ME YOU ARE ALSO HELPING A COMMUNITY,THANKS ALOT.”
kibokoyao, by doing the coding and work for you, I will have accomplished neither goal.
I will gladly help you with your work when you post it; however, I simply do not have the time to write the code for you. You simply must put the effort forth yourself. If instead you’d like to simply copy someone else’s code, there are several code snippet sites for you to query.

-
In Regards to the entire last paragraph:
All uppercase is considered to be yelling - has been since the introduction of lowercase font to line-writers back in the late ‘60s.

Please do not yell at me.

I do not work for you; however, if you would like to establish a contract and consulting fees then you can yell at me as much as you’d like as I will be very well compensated for the abuse.

but would pliz appreciate
Using the proper word “Please” along with the best possible technical writing style is greatly appreciated. You’ll find that posts full of “txtspk” tend to be ignored by a majority of the membership, not just the Experts and Moderators.
Apr 15 '13 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: John Smith | last post by:
I don't think I have understood the concept of Code Access Security in Dotnet fully. 1) I simply can't appreciate the method - *Permission.Assert that asserts the 'right' and bypasses the...
2
by: John J. Hughes II | last post by:
I am having some major problem with maintaining security for my windows application to the SQL. Currently my application access the SQL using System.Data.SqlClient and all forms use stored...
32
by: Mike MacSween | last post by:
Further to 'Security - more complex than I thought' Has anybody ever seen any studies? Or anecdotal evidence? Done any studies themselves? Done any lab testing - you know - 10 users asked to get...
1
by: Dom | last post by:
Hi, I have a problem in getting Access 2002 to read my workgroup file. I've created different groups and users and when the db is opened the user is prompted to enter a username and password...
11
by: Will | last post by:
I am looking at using a table with user names, passwords and user rights, which I would administer. I have read a lot about the shortfalls of this and the lack of security but the customer does...
4
by: ugo_lavoie | last post by:
Hi there, i'm doing a databse right now and i want it to be secure, about 20-30 people (max) will be using it and it will be on a SQL server. My first question: I saw some web page about adding...
3
by: mar10 | last post by:
I'm working on a database for a local business that requires different security for different individuals. There is one PC at the front desk and several individuals will be working with the...
0
by: Namratha Shah \(Nasha\) | last post by:
Hey Guys, Today we are going to look at Code Access Security. Code access security is a feature of .NET that manages code depending on its trust level. If the CLS trusts the code enough to...
3
by: Nerrad | last post by:
hi guys, i have a project on my hand and what i'm told to do is to create a log-in feature using tables and forms. Da question is that is there any way to allow different users different access...
7
by: thebarefootnation | last post by:
Hi, I have created an access db that I would like to secure. The database will exist on a shared drive and be used at a number of different locations hence the reason to secure the database. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.