473,396 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How do I display Windows Username in Form/Table?

I have copied the code found at http://www.mvps.org/access/api/api0008.htm into a module and saved the module as fOSUserName.

Following the directions listed in a similar post (http://bytes.com/topic/access/answer...nto-form-field), I then created a field on my table labeled "UserID" and inserted the field into the related form. I set the default value for the text box in the form to =fOSUserName(), but #Name? is still displayed in the text box when I switch to form view.

Any help would be great!
Feb 16 '12 #1

✓ answered by Rabbit

There's going to be a naming conflict if you give the module the same name as the function.

4 5470
Rabbit
12,516 Expert Mod 8TB
There's going to be a naming conflict if you give the module the same name as the function.
Feb 16 '12 #2
NeoPa
32,556 Expert Mod 16PB
It seems this is less about the actual code in the module and more about referencing that code, but first I would suggest that you check the code works from the Immediate pane of the VBA IDE window (Debugging in VBA). If it's not working for any reason then we have our own article thread on this at Function to Return UserName (NT Login) of Current User. They're probably very similar I expect.

Anyway, if a reference to a Public function in a standard module (I'm assuming that's what you have) isn't working as a DefaultValue for a control on your form, then I'm not sure what is going on. I would expect it to. What version of Access are you using?
Feb 16 '12 #3
Rabbit,

Thanks for the help! I simply renamed the module and it works. You have no idea how much this help out! My headache has miraculously disappeared.

Thanks to you, as well, NeoPa.
Feb 16 '12 #4
NeoPa
32,556 Expert Mod 16PB
Nice catch there by Rabbit :-)

You may want to select the button marked "Best Answer" by post #2.
Feb 16 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Newbie | last post by:
I am a newsbie to ASP but need to get a script together that will insert the Windows Username of the local machine into an access database. I get the errors from my code below, can anyone help me...
3
by: Ken | last post by:
I have a database called autographs.mdb that is in the "XYZ" folder in the "database" folder. I have a form in the database that I want to display a photo of the celeb on. The photos are in a...
8
by: Raj Thakkar | last post by:
Hi, I am currenty working on a site for intranet. I have a user control in the header of every page that will be displayed only if people with certain username are surfing the site. These lists...
2
by: Child | last post by:
my application needs to retrieve windows username - anon authentication is OFF, auth mode in web.config is "windows". I get machine name with Dim ident As WindowsIdentity =...
5
by: nikou_70 | last post by:
I have a problem with ("auth_user") in asp,I try to use windows username and password in asp page for limitation user access to pages, but this server variable returns empty string, can you help me...
8
by: Bruno Barros | last post by:
Hey there. I'm currently working on an intranet, and would like to know how I can get the windows usernames of the visitors. You can get their IP with $_SERVER; But what about their Windows...
1
by: hemel | last post by:
I am going developed a web site where all user have registered with their windows username. So I want to USER NAME fild automically fillup with windows username. How can i do this? Is it possible...
4
by: orajat | last post by:
hi, I'm trying to pull the windows username with jscript and save it to ms access field in a table, but it does not work. it does show the alert with the name of the user but does not save it to...
16
by: blaze77 | last post by:
Hi, I'm somewhat of a power user in excel and a newbie to Access though the possibilities are exciting me :-) I am trying to create a tool in Access to replace an existing tool in Excel. My...
8
by: tiijnar | last post by:
Hi, To get windows username Im using the following code. public class GetWindowUsername { public String getUser() { String userName = System.getProperty("user.name");...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.