Help with tracking user without enforcing security

A

Al

I know that the best way to track who is in the db is to enforce security.
However, I am in a situation where the client does not want the security to
be enforced at least right now. since we will have to keep another file
(.mdw) on the network. Is there a way to track few users (5 max) in access
through code? I have a login form that has 2 text boxes, one for the user ID
and the other for the password. I have a table called tblUserLog that every
time a user logsin, a new record is created in that table keeping the login
ID and date/time. The login form fires the code in the after update event
behind a txt box for the password. I have another table called tblRole, in
which we have every user assigned a level of authority i.e. some fileds would
be locked for a user with authority level, say, 3 but same fields would be
unlocked for user authority level, say, 1. The problem I am have to solve is,
if user with level 1 logged in and in the same time a user with level 3 loged
in, how can the form differentiate between the two in the same time? Some
levels will have a read only on some fields and read/write on others. I have
only 3 levels of authority and about 5 users. I know it would have been a lot
easier with access security but I have to deal with this situation temporarly
until the testing and validation is done.
thanks
 
D

Douglas J. Steele

Realistically, what you want can be done, but it's trivial to circumvent
should anyone want to.

Your question about "how can the form differentiate between the two in the
same time?" makes me suspect that you haven't split your application into a
front-end (containing the queries, forms, reports, macros and modules),
linked to a back-end (containing the tables and relationships). Only the
back-end should be on the server: each user should have his/her own copy of
the front-end, ideally on his/her hard drive.

(Even if you haven't done this recommended step, Access has no problem
distinguishing between the users. This is because a copy of the form is sent
to each workstation: one of the reasons to split, to reduce network traffic)
 
A

Al

The db is going to be front end and back end but you are right the front end
is not going to be on every user machine. It would be on the server, again,
due to logistical problems. giving this situation, when I have the code
behind the form saying that, for example:

select case Authority
case 1
field1.locked = false
field2.locked = false
field3.locked = false
case 2
field1.locked = true
field2.locked = false
field3.locked = false
case 3
field1.locked = true
field2.locked = true
field3.locked = false
end select
now, if a user in the role authority 1 and another in 3 login in the same
time. the form will add 2 new records to the log table now how can the form
know who is who to lock/unlock these fields?
thanks
 
D

Douglas J. Steele

While you may only have a single copy of the MDB (bad mistake), as I said
earlier, in essence each user gets copy of the form sent to his/her
workstation so that there should be no issue.

Stop and think about it for a second. If that weren't the case, then each
user would see what the other users were typing on the form.
 
A

Al

I agree with you. Again this is a temporary setting for a testing period of
time. I am going to use a public variable and set it to equal the authority
level from the login form. based on the value of the variable the form will
behave accordingly.
thanks
Al
 

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