filtering

  • Thread starter Thread starter arthurgrajeda
  • Start date Start date
A

arthurgrajeda

Is there anyway to have a form filter certain data for different users
of the database?

I have created a database for about 6 people to use. Each of us on a
daily basis enter data into it. I have assigned a drop down button
which has each of our names in it. I would like to choose my name and
be able to view all my records and the same for each of us. Can this be
done? If so can someone tell me how?
 
Arthur,

Yes, it can be done and, with a bit of luck, it does not even require any
code... What I mean by "with a bit of luck", is if the users are logging on
to a LAN using different user names. If that's the case, then:
1. I suspect you already have a field for the user in your table; if not,
add one.
2. On your data entry form, add a text box bound to that field, and set its
default value to:
=Environ("UserName")
This will populate this field in new records. This text box can be
visible > no, enabled > yes, locked > no if you wish.
3. Make your form's recordsource a query on the table (instead of the table
itself), and in the criretion line in the user field, type in the same
expression as above. This will filter the particular user's records.

Of course, you will need to employ an update query to change the value in
the user field of already existing records from its current entry (name) to
the LAN user name, so they can still access their older entries.

This solution eliminates the need for users to select their name on the
form, and disables them from deliberately or accidentally accessing other
users' records from the form.

If the LAN user name does not work for you, you could use
Environ("ComputerName") in exactly the same way, assuming every user always
uses their own PC, and there is no sharing between them.

HTH,
Nikos
 
Back
Top