Passing login ID to query.

J

Jeff

Is it possible to have a user login to an ACCESS db, store
the login ID in a variable and then when a user clicks on
a button to view data, have the variable passed to the
query so they can only see the data associate with the
login ID that is in the variable? The table(s) they will
be looking at, will have a field called LOGINID.

If so, how can this be done?

Thank you.
 
C

Christina Belding

Ok, I must be just about as dumb as a bag of hammers on
this one, but I'm having a devil of a time understanding
how the CurrentUser() function works. Will it pick up the
network login name, or what is specified in the user name
once established?

I have no problem admitting defeat, but I'm just not ready
to give this up yet. I have a table with a last name
field that I would like to pass/store as the current
user. In this table I have the user's manager and
password established (yes, I'll lock this table down), but
the end goal would be the ability for the user to update
only there information, and the manager to be able to
update the employee's information if they are assigned.

Any help would be wonderful! Thanks so much! :)
Chris
 
R

Rick B

UserID() returns the user id used to sign on to a secured database using the
built-in Access User-Level security.

If you want to grab the network id, you will have to write a function to do
so. You can search the newsgroup and find many posts with information on
how to do this.

Do some searches and you will find all the answers you need.

Rick B
 
C

Christina_Belding

Rick-

You're a gem! Thanks so much for explaining that! Can I
pick your brain on a concept real quick?

If I have a table that will have the user name in it and
when I set up the user accounts and make their login names
the same as the user name specified in my table, all
should work just fine right? I could then use that in my
where clauses to pull only data specific to that employee
by using the current user()=login name right?

Let me know if you think this would work, or if you know
of other issues that might be opened by Pandora! ;)

Thanks again!
Chris
 
R

Rick B

Sounds like you have it. That is pretty much what my database dows to limit
records. You can also log record modification timestamps and other cool
data once you learn to grab the userid.

Rick B
 
C

Christina_Belding

Yippee! I think I was just getting confused because of
the CurrentUser() versus UserID() functions, and I was
over complicating it.


It makes perfect sense now. So basically, Access creates
a temporary variable based on a hidden table that will
store the user name (as specified in the security wizard),
and then a built in function (the CurrentUser()) delivered
with Access will retrieve the variable. DUH. If I had a
brain, I think I would take it out and play with it! HA!

Seriously though, thank you for allowing me to bounce this
off of you!

Ciao!
Chris
 

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