Declare new function?

D

Duane Hookom

Name is a poor name for a field since name is a reserved word. However, you
might try:
EngineerName=DLookup("[Name]", "Engineer", "[Login]=""" & CurrentUser() &
"""")
 
H

Henro

I need desperately to find a way to declare a function that will lookup the
name of the currentuser ()

To be exact:

tblEngineer
..Name
..Logon

Currentuser () returns nicely the Engineer.Logon of the logged in user.
I need to declare a function that looks up the Engineer.Name of the
currentuser !

How do I do this?

TIA Henro
 
H

Henro

No, a user logs in with his Logon which is also(!) defined in Engineer.Logon
So, my thought is:

since CurrentUser() returns a value which is identical to the field
Engineer.Logon it should be possible to find the Engineer.Name in the same
record using the CurrentUser()

I would like to declare a function UserLogon () which looks up the
Engineer.Name in the same record as Engineer.Logon so I can use UserLogon if
I need to find the Name of the CurrentUser() in a query instead of his/her
Logon.
Problem is: I am a bad programmer :'(
I think I should use the DlookUp but I can't get it working, nor do I know
how to declare a function :-(

grtz Henro
 
H

Henro

U are right about both points: all the problems I had resulted from the use
of 'Name' as a fieldname. And yessss, I finally and suddenly got the DlookUp
right and it's working now!

Thanx for thinking with me!

Henro

Duane Hookom said:
Name is a poor name for a field since name is a reserved word. However, you
might try:
EngineerName=DLookup("[Name]", "Engineer", "[Login]=""" & CurrentUser() &
"""")

--
Duane Hookom
MS Access MVP


Henro said:
No, a user logs in with his Logon which is also(!) defined in Engineer.Logon
So, my thought is:

since CurrentUser() returns a value which is identical to the field
Engineer.Logon it should be possible to find the Engineer.Name in the same
record using the CurrentUser()

I would like to declare a function UserLogon () which looks up the
Engineer.Name in the same record as Engineer.Logon so I can use
UserLogon
if
I need to find the Name of the CurrentUser() in a query instead of his/her
Logon.
Problem is: I am a bad programmer :'(
I think I should use the DlookUp but I can't get it working, nor do I know
how to declare a function :-(

grtz Henro
 

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