473,399 Members | 3,888 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,399 software developers and data experts.

Fine-grained security in Access (record-level)

Vic
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 input. Questions:

1. How could I "automatically" detect which user is logged on to the
network and accessing the database and store its login name in the
table (I know about the current user() function, but I would prefer to
detect who is logged on to the win2k environment (rather than setting
up separate access users which makes users log on twice, once to the
network, then to access)before accessing the database)

2. How can I implement that a user could only see/write those records
from a table which belong to him/her (aka, records containing his
authorID in the the Authors field) and of course could add a new
record?

Appreciate any help, and bear with me, I am a newbie as far as acces
security is concerned...

Viktor
Nov 12 '05 #1
3 3740
Dear Vic,

I'm afraid you won't get far in implementing Access security if you're not
willing to have your users log into Access separately. AFAIK, Windows
networking only allows setting of permissions down to the file level, and of
course all of the distinctions you want to make are going on inside the one
MDB file.
And while Access can return the current network username (see
http://www.mvps.org/access/api/api0008.htm), I know of no way to have it use
that name within its own security model.

Part of the issue is that you log into Access before you execute any code,
which makes it difficult to customize Access's behavior at that point.
(You'd have to be already logged into Access before you could use the code
at the above URL to even retrieve the username.)

HTH
- Turtle

"Vic" <la*****@ntlworld.com> wrote in message
news:52**************************@posting.google.c om...
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 input. Questions:

1. How could I "automatically" detect which user is logged on to the
network and accessing the database and store its login name in the
table (I know about the current user() function, but I would prefer to
detect who is logged on to the win2k environment (rather than setting
up separate access users which makes users log on twice, once to the
network, then to access)before accessing the database)

2. How can I implement that a user could only see/write those records
from a table which belong to him/her (aka, records containing his
authorID in the the Authors field) and of course could add a new
record?

Appreciate any help, and bear with me, I am a newbie as far as acces
security is concerned...

Viktor

Nov 12 '05 #2
You get the w2k user name by this:

dim wsh as object
dim strUser as string

set wsh = createobject("wscript.network")

strUser = wsh.username

set wsh = nothing

'and then set the default of the control on the open event of the form

Me!ctl.DefaultValue = "=" & Chr(34) & strUser & Chr(34)

'lock the control in the form so the user can't change the default

Me!ctl.enabled = false
Me!ctl.locked = true

Depending on how you open the form you could set the filter of the form
to show the user only his own work.


la*****@ntlworld.com (Vic) wrote in message news:<52**************************@posting.google. com>...
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 input. Questions:

1. How could I "automatically" detect which user is logged on to the
network and accessing the database and store its login name in the
table (I know about the current user() function, but I would prefer to
detect who is logged on to the win2k environment (rather than setting
up separate access users which makes users log on twice, once to the
network, then to access)before accessing the database)

2. How can I implement that a user could only see/write those records
from a table which belong to him/her (aka, records containing his
authorID in the the Authors field) and of course could add a new
record?

Appreciate any help, and bear with me, I am a newbie as far as acces
security is concerned...

Viktor

Nov 12 '05 #3
Viktor
You can define network user name by 2 ways:
1. If environment file on your network contins user name, which is
usually the case, you can use a function Environ("USERNAME") - see
Help.
2. You can use Windows API function (please excuse me, the code is
very humble):
Option Compare Database
Option Explicit
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long
Public Function Registr()
Dim lpBuffer As String, nSize As Long, A As String, B As String, x, i
as Integer

'Set up buffer to get the string from the function
nSize = 50
lpBuffer = " "
'API function call
x = GetUserName(lpBuffer, nSize)
'Select from the buffer string without gups
A = lpBuffer
For i = Len(A) To 1 Step -1
If Mid(A, i, 1) <> " " Then Exit For
Next i
User Name= Left(A, i - 1)

To show records only created by a user is very simple. Store AuthorID
defined by UserName somewhere in an invisible field on a start up
form, which doesn't show any data. Base your form, which shows rows of
the data, on a query rather then the table. Make this query criteria
AuthorID=Forms![My start up form]!AuthorID.
Hope it will be of some help.
Galina
la*****@ntlworld.com (Vic) wrote in message news:<52**************************@posting.google. com>...
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 input. Questions:

1. How could I "automatically" detect which user is logged on to the
network and accessing the database and store its login name in the
table (I know about the current user() function, but I would prefer to
detect who is logged on to the win2k environment (rather than setting
up separate access users which makes users log on twice, once to the
network, then to access)before accessing the database)

2. How can I implement that a user could only see/write those records
from a table which belong to him/her (aka, records containing his
authorID in the the Authors field) and of course could add a new
record?

Appreciate any help, and bear with me, I am a newbie as far as acces
security is concerned...

Viktor

Nov 12 '05 #4

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

Similar topics

116
by: Mike MacSween | last post by:
S**t for brains strikes again! Why did I do that? When I met the clients and at some point they vaguely asked whether eventually would it be possible to have some people who could read the data...
10
by: Jayme Pechan | last post by:
I wrote a very simply web application and I'm having all sorts of problems with the security getting in the way. All the web application does is load an out-of-process COM server that is running...
2
by: Jesper Stocholm | last post by:
I have implemented role-based security within my ASP.Net application. However, it seems the role is not passed to the authentication ticket I create. I want to use it to display/hide some...
29
by: Patrick | last post by:
I have the following code, which regardless which works fine and logs to the EventViewer regardless of whether <processModel/> section of machine.config is set to username="SYSTEM" or "machine" ...
1
by: David | last post by:
...i got this error: quote: ------------------------------------------------------------------------------ Access to the path "c:\inetpub\wwwroot\NewsServer\DBRelations\NewsServerBase.xml" is...
1
by: Jeff | last post by:
I am designing a new Windows Forms client application (with SQL Server db on the back end) for which users will authenticate via NT authentication (network), or SQL Server authentication. Users who...
1
by: Shimon Sim | last post by:
How to specify security access for assembly running in ASP.NET? FxCop requests it always and I always ignore it. I am thinking that this is good thing to know how to do. I usually need the...
22
by: Jordan S. | last post by:
SQL Server will be used as the back-end database to a non trivial client application. In question is the choice of client application: I need to be able to speak intelligently about when one...
2
by: siewong | last post by:
Existing Access Database Troubleshooting I am new to access database and inherited an access application and all users who were previously able to use this access file simulataneously are now...
0
by: parez | last post by:
Hi, I have a setup and deployment project. I am using vs 2008. During the setup process, I want to give full security access to run a network exe. How do i do it? I can create a batch...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.