environ("username") Compile Error: Can't find project or library

bconner

Registered User.
Local time
Today, 13:25
Joined
Dec 22, 2008
Messages
183
Hello All,
I have searched all over the internet for a solution and now I am breaking down and posting my problem.

I am trying to grab the username using the below code. This code works fine on my machine however when I send the db to another person it fails and produces the Compile Error: Can't find project or library.

I have checked to make sure there are no missing references and the other person has their macro security set to enable all macros......

I am at a loss for why this won't work on their machine but works fine on mine....
Any help is most appreciated....


Code:
Private Sub Combo80_Change()
Update_Time_Stamp = Now()
txt_UserName = Environ("username")

End Sub
 
You probably don't have the requisite reference. Of the to of my hear, I don't know what it is.
 
Try:

txt_UserName = CreateObject("wscript.Network").Username
 
Thanks Galaxiom.... that worked perfectly....
 
if environ stops working, I would be concerned, as it points to some more serious reference error in their set up, I would think.
 

Users who are viewing this thread

Back
Top Bottom