Query by specific user Help

sysop470

Registered User.
Local time
Today, 05:39
Joined
Mar 25, 2005
Messages
87
Hi.

I want ot create a query for specific users. I have 10 users. my problem is that one of the users can view all the other users entered in the database and the other 9, can view only what each user entered.

example user1 : view only his records
user2 : view only his records
user 10 : view all records entered by user1 and user2

Any help please.
Thanks
 
sysop470,

If you could list the fields in the table that would help. Is this a database of employees? I ask because you said one person should be able to see all the records (a Manager?) If so then once you have all the fields in an Employee Table you want to ensure that their is a SubjectRecordID field that is an autonumber and Primary Key. This will ensure that each person is uniquely identified. You can use this to control access later on.
You can create one query, and copy it, and change the level of access using criteria.

For instance for the users that can only view their record you could use:
Select *
From SubjectTable
Where SubjectRecord ID = (Their Subject Record ID)

OR if you are using the Access Query Wizard:
put each of the fields in the query from the table and put the Person's subjectrecordId number in the criteria under the SubjectRecordID field

This will return only their record. With this query you can then create a Form based on the query and when run, it will retieve only their information.

As for the Manager, You use the Same query but leave out the Where clause and it will return all the records in the table. Of course if you don't want all the fields displayed from the Table, list the fields you want after the SELECT portion of the query. If you store information about your user in different tables (ie SubjectTable, JobTable, TrainingTable) Make sure that the SubjectRecordID field is in each of the tables as a Long Integer Number field) Then you can create the relationships of ONE to MANY from the Subject Table to the Training Table because one employee can have many different training certificates or courses completed. I hope this helps? If not give us some more info and we can go from there,
Tyler
 
thanks a lot
 

Users who are viewing this thread

Back
Top Bottom