How to use the result from a function in a query?

  • Thread starter Thread starter Hallgeir
  • Start date Start date
H

Hallgeir

I have a function that gives me the UserName with which the user is logged
into the network. In other word the function returns the network login name.
In my database I have a table where one of the fields is "Username". Is
there a way that I can use the username that I get from the function as an
parameter in a query? I want to make a query that list out every record in
the table where Username = the network login name.

Thanks,
Hallgeir
 
Hallgeir,

In your query criterion line, just type in Environ("UserName") - it's the
function that returns the Windows logon name, and I bet the same one that's
used in your VB function.

Generally speaking, you could call a VB function in a query criterion line
or calculated field simply by typing its name, but in this case it is not
required to call the function since you can get what you want directly.

HTH,
Nikos
 
In your query criterion line, just type in Environ("UserName") - it's the
function that returns the Windows logon name, and I bet the same one that's
used in your VB function.

HTH,
Nikos

Amazing, I would never figured out that on my own. Your solution will make
things a lot easier for me.
Thank you!

regards
Hallgeir
 
Back
Top