Limiting user access to a table?

B

+Bob+

I have an Access Database (2000, but I could upgrade to 2002).

I would like to limit the access to one of the tables in the d/b so
that only certain users can access it. Ideally, the access would be
linked to the user logon/pass, but that's not an absolute requirement.
This is a simple standalone d/b on one Windows 2000 machine, no A/D,
no domains, etc.

What are my options?
 
T

Tom van Stiphout

On Sat, 12 Apr 2008 23:14:02 -0400, +Bob+ <[email protected]>
wrote:

The Windows login username has been documented here so many times you
should have no problem finding that API call,
From there, it's just an IF statement:
dim sUser as string
sUser - GetWindowsUser() 'some function to get user login name.
if sUser="Tom" or sUser="ictraing" then
'Access granted
else
'Access denied

-Tom.
 
A

a a r o n . k e m p f

BULLSHIT!!!

If you want to get the name of the current user you should just use
this function: SUSER_SNAME().

In other words; you should be able to-- in the reccomended engine for
MS Access- to just use this statement
Select Suser_Sname()

Or; if you want to use this as the default for a column, then you
would just use SUSER_SNAME() as the default

-Aaron
 
T

Tony Toews [MVP]

If you want to get the name of the current user you should just use
this function: SUSER_SNAME().

In other words; you should be able to-- in the reccomended engine for
MS Access- to just use this statement
Select Suser_Sname()

Or; if you want to use this as the default for a column, then you
would just use SUSER_SNAME() as the default

Note that Aaron's answer to just about every question is SQL Server
and ADPs. No matter how appropriate his answer.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
B

+Bob+

On Sun, 13 Apr 2008 15:56:33 -0700 (PDT), "a a r o n . k e m p f @ g m

Sounds like you boys are heading me in the right direction. I have a
few questions. First,

I found some posts on grabbing the network login name, but not the
windows login name. I could use a pointer (unless I use the
suser-sname() suggested below is best).

But, more importantly, do I need this username? Ideally I'd like to
separate the (restricted) data in the main table to another table (or
a separate database?) and then have NT security control access. That
way, regardless of my code or the user's knowledge of Access, I would
be confident that they are not seeing the restricted data.

Or, alternatively, is there some built-in way in MS-Access to truly
restrict user access? I'm a novice when it comes to security within
MS-Access data. If there's an article with an overview I might need to
start there.

As I mentioned above, how would I actually do the grant-or-deny access
part? Are you suggesting that I would just limit access to the forms,
etc that access the data?
If you want to get the name of the current user you should just use
this function: SUSER_SNAME().

Looks simpler for the username! But again I have to fall back to the
question about the actual mechanism to obtain the username.

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top