473,856 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Handling Security at Field Level

I have an Access app with ULS applied. It has a main form and a subform
with a 1:M relationship. My client wants some of his users to be able to
edit 3 fields in the subform but read-only the rest. What's the "preferred"
solution to this?

I thought I could either

provide 2 subforms with their queries permissions set accordingly or

provide 1 subform and use code to loop through the objects to lock/unlock
them depending on who's logged on.

The problem with the first solution is keeping the subforms in sync as the
user navigates. Anyone have a neat solution to share?

Many thanks.

Keith.

Nov 5 '07 #1
6 2071
I think looping through the controls when the form is opened is the way to
go. You definitely don't want to create two subforms if you can avoid it. I
would definitely go with the looping option.

In terms of how to code it, first, you can loop through all controls on the
form using something like:

Dim ctl as control

For each ctl in me.controls
'do whatever
Next

In that case, though, you'd have to check for the type of control, since not
all controls would have a Locked property. So you'd use TypeOf to determine
if it's a text box or combo box or whatever.

Another way would be to set the Tag property of the controls you want to
lock/unlock, and only work with those:

If ctl.tag="whatev er" then
'do locking/unlocking on it
End If

That would be very clean; but then, if you need the Tag property for
something else, it might get a little messy.

The third way would be to store the names of the controls to lock/unlock in
an array or a table. Then, when you loop through all the controls, match the
control name against the array or table, and, if it matches, then apply
locking/unlocking. I would definitely use this third method.

HTH,

Neil
"Keith Wilby" <he**@there.com wrote in message
news:47******** **@glkas0286.gr eenlnk.net...
>I have an Access app with ULS applied. It has a main form and a subform
with a 1:M relationship. My client wants some of his users to be able to
edit 3 fields in the subform but read-only the rest. What's the
"preferred" solution to this?

I thought I could either

provide 2 subforms with their queries permissions set accordingly or

provide 1 subform and use code to loop through the objects to lock/unlock
them depending on who's logged on.

The problem with the first solution is keeping the subforms in sync as the
user navigates. Anyone have a neat solution to share?

Many thanks.

Keith.

Nov 5 '07 #2
"Neil" <no****@nospam. netwrote in message
news:cl******** **********@news svr11.news.prod igy.net...
>I think looping through the controls when the form is opened is the way to
go. You definitely don't want to create two subforms if you can avoid it. I
would definitely go with the looping option.

In terms of how to code it, first, you can loop through all controls on
the form using something like:

Dim ctl as control

For each ctl in me.controls
'do whatever
Next

In that case, though, you'd have to check for the type of control, since
not all controls would have a Locked property. So you'd use TypeOf to
determine if it's a text box or combo box or whatever.

Another way would be to set the Tag property of the controls you want to
lock/unlock, and only work with those:

If ctl.tag="whatev er" then
'do locking/unlocking on it
End If

That would be very clean; but then, if you need the Tag property for
something else, it might get a little messy.

The third way would be to store the names of the controls to lock/unlock
in an array or a table. Then, when you loop through all the controls,
match the control name against the array or table, and, if it matches,
then apply locking/unlocking. I would definitely use this third method.
Thanks very much Neil. I did consider the table method before I posted but
I do like the idea of the tag property method. The tag property is
something I've never used (until now) so I think I'll give it a try.

Thanks again.
Keith.

Nov 5 '07 #3
On Nov 5, 8:44 am, "Keith Wilby" <h...@there.com wrote:
The problem with the first solution is keeping the subforms in sync as the
user navigates.
I don't understand this. I'm assuming a user will navigate via the
Main Form. Surely both sub-forms will update automatically?
If not, it's très easy to use a full-blown form as a sub-form and to
update its recordsource and the default value of its linking field in
the OnCurrent event code of the main form. Using a form as a pseudo
sub-form and rolling your own linking gives some advantages such as
having as many as you want (or memory allows), placement where you
like (not necessarily within the boundaries of the main-form), moving
and sizing the sub-form.
Application Security, IMO, is not really security. What's to prevent a
user from opening the table or query through linking from another mdb,
adp or non-Access application? Security may be more secure when it
exists at the database engine level.
Of course there is no security that will beat the determined hacker. I
use Database Engine Security, two or three fake Security Strands in
Code, the Crypt API, and my own Reciprocal XORing procedures. Will
that beat everybody? Nope! But recently it's prevented my Aunt Alice
from hacking into my RedHeads.mdb and being horrified about my private
life. Of course, she died fifteen or so years ago; that may have
helped too.

Nov 5 '07 #4
"Keith Wilby" <he**@there.com wrote in message
news:47******** **@glkas0286.gr eenlnk.net...

In case anyone's interested, I assigned the usernames to the tag property

User1User2User3

and then used the left, mid and right functions to compare the tag
properties to CurrentUser

If Left(Me.ActiveC ontrol.Tag,5) = CurrentUser Or .... etc

Keith.

Nov 6 '07 #5
I can see how that would work for you. But, personally, I find such
approaches messy. I think a much cleaner and sounder approach would be to
set up a simple table with four fields: CtrlName, User1, User2, User3.
CtrlName is text, and User1-3 are boolean(yes/no). You would enter the
controls you want to lock for one more users in the table, and check the box
for the users for which is should be locked. Then, when looping through the
controls: 1) if the control is not listed in the table, do nothing; 2) if
the control is listed in the table, look up the value in the field that
corresponds to the current user, and, if True, then lock the field;
otherwise, unlock the field.

This approach, obviously, has its limitations, since, if you add users,
you'd have to add fields to the table. But, from what it sounds like, that
sounds like it would be infrequent, if at all.

A better approach still would be to use an array based on a user-defined
type, using the same structure as noted above for the table. That would be
very easy to modify and wouldn't have the overhead of the table.

Anyway, that's how I would do it. But if what you've done works for you,
then great. Glad you got it working!

Neil
"Keith Wilby" <he**@there.com wrote in message
news:47******** **@glkas0286.gr eenlnk.net...
"Keith Wilby" <he**@there.com wrote in message
news:47******** **@glkas0286.gr eenlnk.net...

In case anyone's interested, I assigned the usernames to the tag property

User1User2User3

and then used the left, mid and right functions to compare the tag
properties to CurrentUser

If Left(Me.ActiveC ontrol.Tag,5) = CurrentUser Or .... etc

Keith.

Nov 6 '07 #6
rkc
Keith Wilby wrote:
"Keith Wilby" <he**@there.com wrote in message
news:47******** **@glkas0286.gr eenlnk.net...

In case anyone's interested, I assigned the usernames to the tag property

User1User2User3

and then used the left, mid and right functions to compare the tag
properties to CurrentUser

If Left(Me.ActiveC ontrol.Tag,5) = CurrentUser Or .... etc

Keith.
I think I would delimit the values with a space and use Instr()
if I were to decide this was a good idea.
Nov 6 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3214
by: Hans-Joachim Widmaier | last post by:
Hi all. Handling files is an extremely frequent task in programming, so most programming languages have an abstraction of the basic files offered by the underlying operating system. This is indeed also true for our language of choice, Python. Its file type allows some extraordinary convenient access like: for line in open("blah"): handle_line(line)
3
3781
by: Vic | last post by:
Dear All, I have been developing a small access database, but I am new to security concepts with access. This is a multiuser database, I have a table which will be written by various users through a form as an interface. At the moment, there is an authorId field on the form (other details of authors are in a separate table connected to this table with the authorID) , and every user select their initials from a combo for the record they...
3
3308
by: Br | last post by:
I'm going to go into a fair bit of detail as I'm hoping my methods may be of assistance to anyone else wanting to implement something similar (or totally confusing:) One of systems I've developed has three levels of security. Admins - can see all records Manager - can only see records based on an organisation structure held in a table (simple tree structure) Employee - can only see own records
3
4788
by: Steve - DND | last post by:
I was wondering if anyone can point me to some articles or practices they use for dealing with errors in their applications; particularly in an n-tier design. I am trying to find one way to conveniently handle both soft and hard errors, primarily for display to the end user. One method I have considered is rethrowing exceptions. With this approach, I would throw a plain old ApplicationException, with the Message property as the polite...
3
3445
by: Dave Wurtz | last post by:
All, Does anyone have ideas how they have implemented field (property) level security? I want to handle this from the business object level, not the database level. Is it best to have a security checking method that gets called in the property and throws an exception? If there are several "fields" that are being accessed multiple times, does it hurt from a performance perspective to have these exceptions thrown all of the time? ...
2
2121
by: weetat.yeo | last post by:
Hi all , I need to Security Matrix in my php project. The Security Matrix are Administrator , Engineer, Storeman and Customer. One of my peers said to make php project more robust, he asked me to use byte value as security matrix. For example as shown below: User id Name Security Matrix
2
1778
by: Kevin Frey | last post by:
One of my chief criticisms of validators in an ASP.NET page is that they can result in a developer re-implementing much of the "business logic" of a transaction at the page level. Assuming we have an object that implements business logic, and that object is utilised via an ObjectDataSource, I wish to enquire what the correct method is for handling errors from the business logic object. For example, there are some circumstances where a...
13
431
by: Speed | last post by:
Hi, I was wondering if there is any way to catch exceptions without knowing in advance what errors may occur. What I mean to say is that is it possible to use try {} on a bunch of lines and catch ANY exception that might have occurred within those few lines without the program crashing first ? Thanks a ton,
35
3545
by: eliben | last post by:
Python provides a quite good and feature-complete exception handling mechanism for its programmers. This is good. But exceptions, like any complex construct, are difficult to use correctly, especially as programs get large. Most of the issues of exceptions are not specific to Python, but I sometimes feel that Python makes them more acute because of the free-n- easy manner in which it employs exceptions for its own uses and allows users...
0
10692
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10770
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10376
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7928
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7084
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5754
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4567
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4168
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3194
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.