Filter by current user

Merdok

Nerd
Local time
Today, 19:36
Joined
Jul 10, 2003
Messages
52
Me Again! :)

Ok my form has a login box which lets registered users into the database and then stores their name in a table under the field "last logged in"

What I want to do is use this name to show specific data.

EG: I have a task list which has tasks assigned to various users however every user can see everyone elses tasks wheras they should only be able to see their own.

EG2: I am going to create a notepad section which will be a memo box which users can make notes in, the notes have to be saved in a record but only their notes should be visible to them.

I'm sure this must be possible but I cant figure it out.

I tried using this code: =DLookUp "[LastLoggedIn]","tblSystem","[SysID]=1") in the "filter" property but to no avail.

I think I may be stuck! :rolleyes:
 
Hi there, I think I can help.

what you could try is adding the userID to the tasks table. Once the user is logged on, you can base that filter/query on the ID with a where clause. This would cause the filter to sort it based on the userid.
 
sorry mate but most of that went completely over my head.
 
Sorry, I got excited

Basically, all you need to do is a the userid that the user logs in as to your tasks table as a field. You could then base a query on that field with a where clause to sort only those where the userid is attached to.

EG.

TblTasks

Task_ID
Task_Name
Task_Date_Due
User_ID
 
call me stupid but I still dont know how to do anything you just said! :(

I'm pretty crap at the advanced stuff... I have made query's in the past but most of it has just been luck.
 
Theres a field called CurrentUser() (or something like that, its been awhile since I've used it) but that may only work with Access's workgroups; and it sounds like you made a custom security doohickey.

When I built a database many had to use (for tracking support calls) I would use this to filter by open calls right on the switchboard, so that when they opened the db they had a constnat view of what was still pending, I just had a not-shown restriction of CurrentUser()

Not sure if that helps, or if I'm even reading it right, hope it helps tho.
 
yeah that works for access security but I dont think it does for custom security because the current user is stored in a table rather than a workgroup file.

Thanks anyway though! :)
 
I use custom security in my apps and when the user logs in, I hide the login form rather than close it. That way, I can always refer to the hidden userID for use when filtering queries. So for the queries that need userID filters, use something like:

Where UserID = Forms!frmLogin!txtUserID;
 
aaaah that sounds promising... will have to try that one! :)
 

Users who are viewing this thread

Back
Top Bottom