lstbox and users

  • Thread starter Thread starter d9pierce
  • Start date Start date
D

d9pierce

Hi all,
One more question!

I am trying to create a listbox on a frmProjects. The listbox would be
called "MyProjects" and be populated by the users that is loged on
according to his/her log on name and it would have to match the
"emoplyee" in the employeetbl. The lstbox would populate the form of
course by clicking on the project(s) listed in the lstbox. I really
need some help with this!
Thaks,
Dave
 
As per my other example, the current logged in name can be had via

CurrentUser()

(above assumes you using user level security, otherwise CurrentUser() will
*always* return admin)

So, in your forms on-load event, you simply go:

dim strSql as string

strSql = "select * from employeetbl where emoplyee = '" & currentUser() &
"'"
me.MyListBoxNameGoesHere.RowSource = strSql

Of course if you not using user level security, then:

You can get the current network logon name with:

http://www.mvps.org/access/api/api0008.htm

And, the current computer name with:

http://www.mvps.org/access/api/api0009.htm

And, if using ms-access security, then currentuser() will return the
ms-access logon.

I often log all 3 of the above values in some applications to track who
updated the reocrd last.
 
As per my other example, the current logged in name can be had via

CurrentUser()

(above assumes you using user level security, otherwise CurrentUser() will
*always* return admin)

So, in your forms on-load event, you simply go:

dim strSql    as string

strSql = "select * from employeetbl where emoplyee = '" & currentUser() &
"'"
me.MyListBoxNameGoesHere.RowSource = strSql

Of course if you not using user level security, then:

You can get the current network logon name with:

http://www.mvps.org/access/api/api0008.htm

And, the current computer name with:

http://www.mvps.org/access/api/api0009.htm

And, if using ms-access security, then currentuser() will return the
ms-access logon.

I often log all 3 of the above values in some applications to track who
updated the reocrd last.

Thank you very much, i thought that was going to be a real pull my
hair out routine and you made this so simple!
Thanks!
Dave
 
Back
Top