Re: load a filtered form based on user login

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



OK, that is clearer, however changing the recordsource should not cause a
problem.

Whether they are adding their time (opening the form for add data only), or
editing existing records, you'd want the recordsource to be restricted to
their username (except for the supervisors). So I don't understand how
changing the recordsource to a query, caused a problem for adding records?


--
Joan Wild
Microsoft Access MVP

najah via AccessMonster.com wrote:
I apologize if it makes no sense. I'll try to clarify:

The enter time and edit/view time*** are both based on the
frmTime*** (recordsource is tblTime***). It is only the mode in
which it opens, that is different. When they enter time, the form
opens in add mode, when they edit/view time, the form opens in edit
mode. I followed your advice and created a query with the criteria
for the employee to be current user. Because both of these tasks(
enter time and view/edit ) launch the frmTime***, when I changed
the recordsource to match the new query to edit/view, It caused the
enter time not to run properly.

Joan Wild wrote:
On my switchboard there is a command button to enter time which
launches the Time*** form in add mode. The
[quoted text clipped - 11 lines]
changing the recordsource to match the query it affected Time***
in add mode.

This makes no sense. You said the enter time*** was based on a
table called Time***. The view/edit time*** you said is based
on a query. Changing the query has no impact on the table, so should
not affect your enter time***. Please clarify.

Also, I need the supervisors to be able to view all the records not
just theirs and with employeeID=currentuser that limits their view
also.

You can set the recordsource at runtime. There is a function in the
security FAQ you can use to determine if the currentuser is a member
of a security group. Use that to determine if they are a
supervisor. i.e.

If faq_IsUserInGroup("Supervisors",CurrentUser) then
Me.RecordSource = "SELECT * FROM Time***"
Else
Me.RecordSource = "SELECT * FROM Time*** WHERE [EmployeeID] = "
& chr(34) & CurrentUser() & chr(34)
End If

You could put that in the open event of the view/edit form.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-tablesdbdesign/200608/1


.


Quantcast