User Logins & Access Levels

J

Jeff Monroe

I have a database where I have customized the user login function. My
table (tblEmployees) contains four fields (lngEmpID, strEmpName,
strEmpPassword, strAccess). When launched, the user selects their
EmpName from a combo-box and enters their EmpPassword.

What I cannot figure out is how to get their Access (access level:
Admin, User, Viewer) from tblEmployee and use it to limit buttons,
forms and user data (allow the user to edit their data in a form, but
not see other's).

I tried using DLookup() in the form Load event:

('strAccessLevel = DLookup("[strAccess]", "[tblEmployees]", "lngEmpID =
lngMyEmpID"))

But I appear to be way off. I am trying to use lngEmpID determined at
login (lngMyEmpID is a variable set in a separate module).

How do I get the data from Access (field in tblEmployees) to use in a
form's Load event in order to limit button, form access to non-Admin
users? How do I filter tblEmployee data in form based on the EmpID or
EmpName logged in?

Thanks.

Jeff Monroe
 
R

Rick Brandt

Jeff Monroe said:
I have a database where I have customized the user login function. My
table (tblEmployees) contains four fields (lngEmpID, strEmpName,
strEmpPassword, strAccess). When launched, the user selects their
EmpName from a combo-box and enters their EmpPassword.

What I cannot figure out is how to get their Access (access level:
Admin, User, Viewer) from tblEmployee and use it to limit buttons,
forms and user data (allow the user to edit their data in a form, but
not see other's).

I tried using DLookup() in the form Load event:

('strAccessLevel = DLookup("[strAccess]", "[tblEmployees]", "lngEmpID =
lngMyEmpID"))

But I appear to be way off. I am trying to use lngEmpID determined at
login (lngMyEmpID is a variable set in a separate module).

How do I get the data from Access (field in tblEmployees) to use in a
form's Load event in order to limit button, form access to non-Admin
users? How do I filter tblEmployee data in form based on the EmpID or
EmpName logged in?

DLookup("[strAccess]", "[tblEmployees]", "lngEmpID =" & lngMyEmpID)

I should also point out that "home-grown" security like you are attempting is SO
easily bypassed by people who are familiar with Access that it is usually a big
waste of time. For example you do know that the table containing all user names
and passwords could simply be imported or linked to from another file, right?
 
J

Jeff Monroe

Rick said:
"Jeff Monroe" (e-mail address removed) wrote in messag


I have a database where I have customized the user login function. My
table (tblEmployees) contains four fields (lngEmpID, strEmpName,
strEmpPassword, strAccess). When launched, the user selects their
EmpName from a combo-box and enters their EmpPassword.

What I cannot figure out is how to get their Access (access level:
Admin, User, Viewer) from tblEmployee and use it to limit buttons,
forms and user data (allow the user to edit their data in a form, but
not see other's).

I tried using DLookup() in the form Load event:

('strAccessLevel = DLookup("[strAccess]", "[tblEmployees]", "lngEmpI
=
lngMyEmpID"))

But I appear to be way off. I am trying to use lngEmpID determined at
login (lngMyEmpID is a variable set in a separate module).

How do I get the data from Access (field in tblEmployees) to use in a
form's Load event in order to limit button, form access to non-Admin
users? How do I filter tblEmployee data in form based on the EmpID or
EmpName logged in?-

DLookup("[strAccess]", "[tblEmployees]", "lngEmpID =" & lngMyEmpID)

I should also point out that "home-grown" security like you ar
attempting is SO
easily bypassed by people who are familiar with Access that it i
usually a big
waste of time. For example you do know that the table containing al
user names
and passwords could simply be imported or linked to from another file
right?

--
Rick:

Yes, I understand the risks of doing security this way, but it wil
serve my purpose for this application.

Thanks for the tip. I will try it out later this evening.

Jef
 
J

Jeff Monroe

Rick said:
"Jeff Monroe" (e-mail address removed) wrote in message


I have a database where I have customized the user login function. My
table (tblEmployees) contains four fields (lngEmpID, strEmpName,
strEmpPassword, strAccess). When launched, the user selects their
EmpName from a combo-box and enters their EmpPassword.

What I cannot figure out is how to get their Access (access level:
Admin, User, Viewer) from tblEmployee and use it to limit buttons,
forms and user data (allow the user to edit their data in a form, but
not see other's).

I tried using DLookup() in the form Load event:

('strAccessLevel = DLookup("[strAccess]", "[tblEmployees]", "lngEmpID
=
lngMyEmpID"))

But I appear to be way off. I am trying to use lngEmpID determined at
login (lngMyEmpID is a variable set in a separate module).

How do I get the data from Access (field in tblEmployees) to use in a
form's Load event in order to limit button, form access to non-Admin
users? How do I filter tblEmployee data in form based on the EmpID or
EmpName logged in?-

DLookup("[strAccess]", "[tblEmployees]", "lngEmpID =" & lngMyEmpID)

I should also point out that "home-grown" security like you are
attempting is SO
easily bypassed by people who are familiar with Access that it is
usually a big
waste of time. For example you do know that the table containing all
user names
and passwords could simply be imported or linked to from another file,
right?

--
Rick:

It worked, thanks.

BTW: Do you know of any tutorials or guides out there to help me in
utilizing the Access Security feature (if I wanted to use it)? I know I
need to be careful, because I have seen instances where I had to enter
passwords for all of my databases on my computer if I am not careful.

Thanks again.

Jeff
 

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