It's a function. The only way to get a value from a function is to call the
function.
You could assign its value to a global variable and then refer to the global
variable. However, I'd recommend calling the function each time, to ensure
that nothing's happened to the value of the variable. There's very little
overhead involved in the call.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"JMorrell" <(E-Mail Removed)> wrote in message
news:2437CA4D-1951-4C34-9E54-(E-Mail Removed)...
> I understand now. Thanks. I can think of lots of ways that this can be
of
> use to me. Isn't there a way to make the fOSUserName known globally, as
in
> "until user logs off?" I don't think I would want to run (or maybe I
would)
> every time I need the UserName. I made it Public, instead of Private, but
> the value of fOSUser was "<Out of context>" in subsequent forms, reports,
> etc.
>
> Let me explain what I want to be able to do. I want a user to be able to
> look at their own records in an HR type database. I also want any
supervisor
> to be able to look at any of their employees records. By capturing the
> logged on user name, I can reference all of their "downstream" employees.
>
> I'm open to any suggestions as to how best go about this.
>
> tiaa,
> JMorrell
>
> "Douglas J. Steele" wrote:
>
> > Save the module you copied the code into (make sure you don't name the
> > module fOSUserName).
> >
> > Now, call the function fOSUserName wherever you want to know the user
name.
> >
> > For example, you can set the Control Source for a text box to
> > =fOSUserName(), and the text box will then show the user name. (make
sure
> > you include the = sign)
> >
> >
> >
> > --
> > Doug Steele, Microsoft Access MVP
> > http://I.Am/DougSteele
> > (no e-mails, please!)
> >
> >
> >
> > "JMorrell" <(E-Mail Removed)> wrote in message
> > news:7E1402ED-DBD1-4493-8CBB-(E-Mail Removed)...
> > > I've read posts about capturing the NT logon ID and looked at the
script
> > > posted here -> http://www.mvps.org/access/api/api0008.htm
> > >
> > > I've a really simple question now. Now that the module is created,
now
> > > what? How do I run it, use it, read the fOSUserName? Sorry, but this
is
> > new
> > > territory for me.
> > >
> > > tia,
> > > --
> > > JMorrell
> >
> >
> >