J
JimS
I've had the fosusername() function running on a client's computer for a long
time. Suddenly, it can't find the "tacomp90.ocx" library when executing
fOSUsername().
The function references "advapi32.dll" and errors out on a function call:
strUserName=String$(254,0)
Here's the code, straight from the MVP web site. Strangely, it works on my
computer, and not on hers:
Note: I did add in FMS codetools, etc to my computer, used on that database.
But that doesn't seem to be the module it's having troubles with...
Option Compare Database
Global glbUserName As String
Global glbUserId As String
Global glbUserAuthLevel As Long
Global glbModuleID As Byte
'******************** Code Start **************************
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If (lngX > 0) Then
fOSUserName = UCase(Left$(strUserName, lngLen - 1))
Else
fOSUserName = vbNullString
End If
End Function
'******************** Code End **************************
time. Suddenly, it can't find the "tacomp90.ocx" library when executing
fOSUsername().
The function references "advapi32.dll" and errors out on a function call:
strUserName=String$(254,0)
Here's the code, straight from the MVP web site. Strangely, it works on my
computer, and not on hers:
Note: I did add in FMS codetools, etc to my computer, used on that database.
But that doesn't seem to be the module it's having troubles with...
Option Compare Database
Global glbUserName As String
Global glbUserId As String
Global glbUserAuthLevel As Long
Global glbModuleID As Byte
'******************** Code Start **************************
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If (lngX > 0) Then
fOSUserName = UCase(Left$(strUserName, lngLen - 1))
Else
fOSUserName = vbNullString
End If
End Function
'******************** Code End **************************