Selasa, 22 Mei 2012

[AccessDevelopers] Re: Current User Access to Own Records

 


Thanks all for your suggestions! Tomorrow when I head to work, I will try these ideas.

I thought I'd attach my db for your reference in case you needed to see how the db works. I've posted it in the files section.

--- In AccessDevelopers@yahoogroups.com, "Toby Bierly" <toby@...> wrote:
>
> You should have a form that gives a list of employees, either in a continous form or in a listbox. Whenever you choose one of the 3 options from the main menu (other than exit), it should pull up this form which should be filtered to only show the current user's employees. Actually, it may be easiest to make this the "main menu" and just add 3 buttons to this form to
> 1. Add/Edit Employee Information
> 2. Evaluate Selected Employee
> 3. Print Evaluation for Selected Employee
>
> So after signing in, they go straight to this form where they can pick (or add) an employee and perform or print an evaluation.
>
> In your employees table, you should have a field for Manager or Current User or whatever you want to call it. It should store the usernames that the users use to sign in. After the user signs in, leave the sign in form open and just hide it so the user name can be used as criteria in queries. This can be done by putting event code for the click event behind the button used to sign in.
>
> Me.Visible = False ' (Me always refers to the form the code is in)
> or
> Forms!SignInFormName.Visible = False
>
> In order to filter the employee list form or listbox, the query for the form's RecordSource property or the listbox's RowSource property should look something like:
>
> SELECT field1, field2, field3 FROM tbl_Employees WHERE Manager = Forms!SignInFormName!txt_Manager
>
> There are various ways (click, double-click, click a button next to, or select and click a button) to open up the other forms you have created from this list. But now you can open them up specifiic to the employee chosen in the list (which was filtered to only the employees that Manager should see). Whatever event triggers the forms to be opened, they can be filtered at opening using an argument in the OpenForm method:
>
> DoCmd.OpenForm "FormNameBeingOpened", , , "Employee_ID=" & Me.lst_ChooseEmployee ' for a list box with Employee ID as bound column of list box
> or
> DoCmd.OpenForm "FormNameBeingOpened", , , "Employee_ID=" & Me.txt_Employee_ID ' for a continuous form
>
> Hope this helps,
> Toby
>
> -----Original Message-----
> From: AccessDevelopers@yahoogroups.com [mailto:AccessDevelopers@yahoogroups.com] On Behalf Of gbonnaville
> Sent: Tuesday, May 22, 2012 9:17 AM
> To: AccessDevelopers@yahoogroups.com
> Subject: [AccessDevelopers] Current User Access to Own Records
>
>
>
> Hello All! Access has certainly changed since the last time I used it (back in the 90s, LOL). I am currently building a db to house employee information and evaluations. The majority of the db is already written...YIPPPEEE!
>
> The problem I am having and been trying to figure out for the last week is the programming code I need to ensure the Current User has access to ONLY their Own Records.
>
> When a user opens the db, they need to sign into the db with a username and password. From this point, they go to a main menu where they can select:
>
> - enter Employee Information
> - evaluation section
> - print an evaluation or
> - exit.
>
> I want the manager to only have access to their own employees and not employees of the whole company. So if they access either option they can view, edit and add only their staff members.
>
> Is this possible? If so HOW do I go about creating the code? VBA? SQL? I just know that I am beyond frustrated trying to figure this portion out.
>
> Any help would be appreciated!!!
>

__._,_.___
Recent Activity:

Please zip all files prior to uploading to Files section.
.

__,_._,___

Tidak ada komentar:

Posting Komentar