By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,395 Members | 1,382 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,395 IT Pros & Developers. It's quick & easy.

Get windows logon username into a form field

P: n/a
Hi How do I get the windows login name into a field on a form? I found
this code from searching but I can't figure out how to use it...
http://www.mvps.org/access/api/api0008.htm

Thanks,
Ciarán
Sep 30 '08 #1
Share this Question
Share on Google+
9 Replies


P: n/a
"Cron" <cr*******@hotmail.comwrote in message
news:f2**********************************@y21g2000 hsf.googlegroups.com...
Hi How do I get the windows login name into a field on a form? I found
this code from searching but I can't figure out how to use it...
http://www.mvps.org/access/api/api0008.htm

Thanks,
Ciarán

Assuming you've saved the code in a module, put the name of the function in
the "Default Value" property of the control you want to display it:

=fOSUserName

Keith.
www.keithwilby.com

Sep 30 '08 #2

P: n/a
Cron wrote:
Hi How do I get the windows login name into a field on a form? I found
this code from searching but I can't figure out how to use it...
http://www.mvps.org/access/api/api0008.htm

Thanks,
Ciarán
Dim strLoginName As String
strLoginName = fOSUserName()

Texas
http://www.youtube.com/watch?v=dWlUSR6wSzA
Sep 30 '08 #3

P: n/a
On Sep 30, 2:45*pm, "Keith Wilby" <h...@there.comwrote:
"Cron" <cronok...@hotmail.comwrote in message

news:f2**********************************@y21g2000 hsf.googlegroups.com...
Hi How do I get the windows login name into a field on a form? I found
this code from searching but I can't figure out how to use it...http://www.mvps.org/access/api/api0008.htm

Thanks,
Ciarán

Assuming you've saved the code in a module, put the name of the function in
the "Default Value" property of the control you want to display it:

=fOSUserName

Keith.www.keithwilby.com
Thanks for the reply Keith, I've added the code to a new module and
made a new form containing one field with default value =fOSUserName.
The field reads "#Name?" when the form is run. Do I need to link the
module to the form somehow? Sorry I've only done very simple stuff
with VBA.
Cheers
Ciarán
Sep 30 '08 #4

P: n/a

"Cron" <cr*******@hotmail.comwrote in message
news:b5**********************************@y21g2000 hsf.googlegroups.com...
On Sep 30, 2:45 pm, "Keith Wilby" <h...@there.comwrote:
"Cron" <cronok...@hotmail.comwrote in message

news:f2**********************************@y21g2000 hsf.googlegroups.com...
Hi How do I get the windows login name into a field on a form? I found
this code from searching but I can't figure out how to use
it...http://www.mvps.org/access/api/api0008.htm

Thanks,
Ciarán

Assuming you've saved the code in a module, put the name of the function
in
the "Default Value" property of the control you want to display it:

=fOSUserName

Keith.www.keithwilby.com
Thanks for the reply Keith, I've added the code to a new module and
made a new form containing one field with default value =fOSUserName.
The field reads "#Name?" when the form is run. Do I need to link the
module to the form somehow? Sorry I've only done very simple stuff
with VBA.
Cheers
Ciarán

You might try setting the Default Value to =fosUserName().
Fred Zuckerman
Sep 30 '08 #5

P: n/a
Cron wrote:
On Sep 30, 2:45 pm, "Keith Wilby" <h...@there.comwrote:
>>"Cron" <cronok...@hotmail.comwrote in message

news:f2**********************************@y21g20 00hsf.googlegroups.com...
Hi How do I get the windows login name into a field on a form? I found
this code from searching but I can't figure out how to use it...http://www.mvps.org/access/api/api0008.htm

Thanks,
Ciarán

Assuming you've saved the code in a module, put the name of the function in
the "Default Value" property of the control you want to display it:

=fOSUserName

Keith.www.keithwilby.com
I created a new form, put in a text box and entered
=fOSUserName
and attempted to run the form. Got a #Name. I reopened the form in
design mode And the default value looked like
=[fOSUserName]

I changed it to
=fOSUserName()
and it worked.

>
Thanks for the reply Keith, I've added the code to a new module and
made a new form containing one field with default value =fOSUserName.
The field reads "#Name?" when the form is run. Do I need to link the
module to the form somehow? Sorry I've only done very simple stuff
with VBA.
Cheers
Ciarán
Sep 30 '08 #6

P: n/a
On Sep 30, 8:26*pm, Salad <o...@vinegar.comwrote:
Cron wrote:
On Sep 30, 2:45 pm, "Keith Wilby" <h...@there.comwrote:
I changed it to
* * * * =fOSUserName()
and it worked.

Brilliant! Perfect! Thanks!
Oct 1 '08 #7

P: n/a
"Cron" <cr*******@hotmail.comwrote in message
news:2f**********************************@u26g2000 hsd.googlegroups.com...
On Sep 30, 8:26 pm, Salad <o...@vinegar.comwrote:
Cron wrote:
On Sep 30, 2:45 pm, "Keith Wilby" <h...@there.comwrote:
I changed it to
=fOSUserName()
and it worked.
Brilliant! Perfect! Thanks!
Missed the brackets, sorry folks.

Oct 1 '08 #8

P: n/a
>Hi How do I get the windows login name into a field on a form? I found
>this code from searching but I can't figure out how to use it...
http://www.mvps.org/access/api/api0008.htm
wonder why a marvellous site like http://www.mvps.org show a solution for
something, already accessible through:
environ("username")
--
Benny Andersen
Oct 1 '08 #9

P: n/a
"Benny Andersen" <a.*********@gmail.comwrote in message
news:88****************************@40tude.net...
>>Hi How do I get the windows login name into a field on a form? I found
this code from searching but I can't figure out how to use it...
http://www.mvps.org/access/api/api0008.htm

wonder why a marvellous site like http://www.mvps.org show a solution for
something, already accessible through:
environ("username")
Because that variable can apparently be modified by a smart user.

Oct 1 '08 #10

This discussion thread is closed

Replies have been disabled for this discussion.