Filter a form by whom is logged on?

unluckytoe

Registered User.
Local time
Today, 01:36
Joined
Oct 14, 2009
Messages
43
Hello All:

I have an issue and I hope that you could assist me.

When a user logs into the DB, I would like all the records for the user to be the only ones that he can view/edit.

The table name where all of records in question are is called: Devices
This table is bound to a query: Devices Extended
The table name where the user names are used to log into: tbl_UserAccess

Devices
ID (PK)
Customer (field that needs to be filtered)

tbl_UserAccess
MyID (PK)
UserName

I hope this make sense. If not I can supply you with any info that you need.

Thank you for your time:

Brian
 
How have you defined which records in the Devices table belong to which user? You need a way to create a relationship between the UserName and the Devices. If the users manually create each device record then you can store thier user name in a field in the Devices table when ever they create a new record.
 
Thank you for replying ghudson, I'm still learning access 2007 so please bear with me.

If I understand you correctly, you would like me to setup a new field in my devices table for the username, than create a relationship between the two tables?

If this is the case, than what do I need to filter it with? Or how would I set this up?

Thank you again:

Brian

Edit: Each user is assigned a "Customer", those are the records that need to be filtered. (cboCustomer)
 
Hello All:

I have an issue and I hope that you could assist me.

When a user logs into the DB, I would like all the records for the user to be the only ones that he can view/edit.

The table name where all of records in question are is called: Devices
This table is bound to a query: Devices Extended
The table name where the user names are used to log into: tbl_UserAccess

Devices
ID (PK)
Customer (field that needs to be filtered)

tbl_UserAccess
MyID (PK)
UserName

I hope this make sense. If not I can supply you with any info that you need.

Thank you for your time:

Brian

At the highest level this has a straighforward solution. All records must have a UserID Column that is a FK to the User name table and indicates the user that entered them. Once this is in place, all queries that Forms are based on can use this UserID Column and compare it to the database userID of the current user. There will probably be other issues to contend with, but this is a good start, so try this first and see if it gives you what you are looking for.

NOTE: It looks like gHudson completed posting while I was still creating mine. We are saying about the same thing. You need a table of UserIDs that includes at least a Database UserName, and a unique User ID. Other information would be optional and is not required for this example. Each record that is entered would include a Column that the user does not need to enter, which defines the UserID of the user entering the informatoin.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom