First time setting up security

  • Thread starter Thread starter Joanna
  • Start date Start date
J

Joanna

My question is 2-in-1. I have a time tracking database for 30+ employees. In
it their is a time card report where (currently, anyway) you select a person
from a drop-down list and it generates that person's "time card". This
current system is not restrictive enough from an HR perspective. I need to
set up security so that each of the 30+ people can log on with their own
password and see the time card report with only thier information on it. I
could set up a user group that blocks everyone out of everything except that
one report, but that doesn't solve the HR issue, because you can't allow
everyone to view everyone else's info. QUESTION 1: Do I really need to set up
30 separate user accounts? QUESTION 2: Even if I do need to set up 30
separate accounts, how can I take that login information that they use and
tell the report to show me records for only that person? It ocurred to me
that I could set up 30 separate reports (1 for each employee) and set up user
accounts so they could only open thier own copy, but that seems like an
inefficient way to do it... especially if I ever need to change the design of
the form. Thank you SO MUCH for your input!!
 
On Mon, 24 Nov 2008 09:09:01 -0800, Joanna

Yes, that would be highly inefficient and a firing offense in some
companies.
More than likely these users already have accounts: they log into
Windows, don't they? Then just ask Windows who is logged in. See this
article for the details: http://www.mvps.org/access/api/api0008.htm
(and bookmark that site!)
Get the logged in name at startup time and store it in a global
variable (say g_strLoginName). Write a public function in a standard
module to return that value:
public function GetLoginName() as String
GetLoginName = g_strLoginName
end function

Now when the timecard opens the underlying query, it runs something
like:
select * from myTable
where LoginName = GetLoginName()
so it pulls only the records for the current user.

You write a similar query for the one-and-only report.

-Tom.
Microsoft Access MVP
 
Back
Top