User-Level Security Problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

I have a database which enables users to log information about what they do.
I'd like to have it set up so that each user can read and append the entries
they've made on the table, but not those for other people.

How can I do this without giving each user a different table to access and
using user-level security on those objects?

Hope somebody can help,

Matt
 
Matt L said:
Hi all,

I have a database which enables users to log information about what they
do.
I'd like to have it set up so that each user can read and append the
entries
they've made on the table, but not those for other people.

How can I do this without giving each user a different table to access and
using user-level security on those objects?
You need to store the users' identities as they create records then test the
identity field against the CurrentUser function, setting the allow edits
property accordingly in the form's On Current event.

Regards,
Keith.
www.keithwilby.com
 
Keith,

Thanks for the advice - unfortunately I don't understand how I'd store the
identities of the users with the records, or how I might test anything
against a function. I understand the concepts, just not how you'd actually
prod Access into doing that.

Anybody who could clarify and give some pointers as to where to head in
Access to make it do these things would be much appreciated.

Matt L
 
Matt L said:
Keith,

Thanks for the advice - unfortunately I don't understand how I'd store the
identities of the users with the records, or how I might test anything
against a function. I understand the concepts, just not how you'd actually
prod Access into doing that.

Anybody who could clarify and give some pointers as to where to head in
Access to make it do these things would be much appreciated.
Hi Matt.

Assuming you have user-level security set up and you have given each user
their own username then you can retrieve that username from code using the
CurrentUser function. So if you have a form for creating new records and a
text box bound to a field for recording usernames, set its default value to
"CurrentUser()" (without the quotes).

You can also record the date and time in a similar way using the Now()
function.

Once this is up and running you can test your text box (let's call it
"txtUserName") against the CurrentUser function in your form's On Current
event and set permissions accordingly:

If Me.txtUserName = CurrentUser Then
Me.AllowEdits = True
Else
Me.AllowEdits = False
End If

Hope that clarifies things a little.

Regards,
Keith.
www.keithwilby.com
 
Back
Top