Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

=Environ("username") in Access 97

Status
Not open for further replies.

paulbasi

Technical User
Jun 21, 2002
14
0
0
CA
Hello,
I am using this in my DEFAULT value in a table from a tip that I got here. I tried it at home running Windows XP and it works great. However, at work where we have users with Win95, NT4 and XP, the default will not work with Windows 95. Can someone please give me some guidance?

Paul :)

paul.basi@ctfs.com
 
Here's a function that returns the user's NT name:

Option Compare Database
Option Explicit

Public Declare Function WNetGetUser Lib "mpr.dll" Alias "WNetGetUserA" (ByVal lpName As String, ByVal lpUserName As String, lpnLength As Long) As Long 'i.e. strUserNetworkName = WNetGetUser "", strUser, 255

Function GetUsersNetworkName() As String
Dim strUserName As String

strUserName = Space(255)
WNetGetUser "", strUserName, 255

GetUsersNetworkName = Trim(strUserName)

End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top