Help with setting user permissions/restrictions on viewing records

skp

Registered User.
Local time
Yesterday, 16:05
Joined
Feb 28, 2011
Messages
21
I am wanting make my database so whichever user is logged in that they will only be able to view the records they have entered and not other users records. Not sure of this would need a code or just some setting somewhere but everything I've tried so far has had no luck. Any help would be great, thanks.
 
if you are recording their username in the record, and they access the records through a form you could have this on form open:

strUser = VBA.Environ("username")
me.filter = "usernameField = " & strUser
me.filteron = true
 
Good idea SpentGeezer, I have my database based on contractual records, I have segregated my users to work only in their relative contracts.

The OP should create a users list first and record their login entries in a UserLog table while login to the application, so whenever any user log, he/she can be allowed to their relevant records.
 
Obviously following what you've already been adviced (by Spent and Khalid), but instead of using the form's filter, it would be much better to have it in the CRITERIA row under the UserName field which is pointing to a textbox that displays the user's name. So to elaborate, create a function to get the username:
Code:
Public Function GetUser()
    GetUser = Environ("username")
End Function
In a textbox (probably on the switchboard) you call the function:
Code:
=GetUser()
In the Criteria row under the User Name field in the query, you put:
Code:
[Forms]![[COLOR=Red]NameOfSwitchboardForm[/COLOR]]![[COLOR=Red]NameOfGetUserTextbox[/COLOR]]
Amend the red bits.
 

Users who are viewing this thread

Back
Top Bottom