retrieving username fails . .

TjS

Registered User.
Local time
Today, 18:52
Joined
Jul 18, 2007
Messages
126
Code:
Function fOSUserName() As String
On Error GoTo fOSUserName_Err

fOSUserName = Environ("Username") ' of vba.environ("Username")
Environ ("Username")

fOSUserName_Exit:
  Exit Function
  
fOSUserName_Err:
  MsgBox Error$
  Resume fOSUserName_Exit

End Function

Above mentioned code i use to retrieve the username from the network and use this username to specify information when retrieving information from a database.

What is my problem?
Well....on some network-clients this retrieving works perfectly the username is retrieved correctly and put into the table,
but on other network-clients (also tried logging in as myself on both mentioned network-clients) i get an error on the 4th line (
Code:
fOSUserName = Environ("Username")
on the word environ...

Please advise what could be the issue here?:confused:
 
Thanks

I have found a set of code searching this forum which accordingly to the notes, retrieves the username (and computername if applicable).
'
Thanks for all the help!
 
sharks....it doesn't work..

also this code doesn't work....anyone familiair with the problem that access causes problems when retreivnig the username? I tried four sets of different code to retreive it, none of it works in all workspaces...
 

Users who are viewing this thread

Back
Top Bottom