I would like to declare a Public Function or Public Variable

H

Henro

that returns the NAME of the current user, not his logon-id in my Database

I will try to explain:

I have a table including all of the user's details.
Amongst them are Name and login code

tblEngineer
Name
LogonID

In different query's I can sort the user relevant data using the
currentuser() but in some places I need to to that by Engineer.Name.
I want to declare a public variable (f.e. CurrentName) that I can use to
select data from a query that only returns data in which the current users
NAME is mentioned.

Any idea's how to do that?

TIA Henro
 
D

Douglas J. Steele

Check http://www.mvps.org/vbnet/code/network/netusergetinfo.htm at Randy
Birch's VBNet site.

Note that you often need to be careful using the code at Randy's site with
Access, as his code is aimed at VB programmers and there are differences
between how the two handle forms. That particular example I cited, though,
should port to Access without any problems.
 
A

Albert D. Kallal

The function would look like:


Function GetFullName() as string

GetFullName = dlookup("Name","tblUsers","LogonID = '" & currentuser() &
"'")

end function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top