Can anybody help. How can I get the name of the currently logged on Novell user TIA
G Guest May 23, 2007 #1 Can anybody help. How can I get the name of the currently logged on Novell user TIA
A Arvin Meyer [MVP] May 23, 2007 #2 Try: Function NetworkUserName () As String Dim iStringLength As Integer Dim sString As String * 255 iStringLength = Len(sString) sString = String$(iStringLength, 0) If WNetGetUser(sString, iStringLength) = 0 Then NetworkUserName = Left$(sString, iStringLength) Else NetworkUserName = "Unknown" End If End Function
Try: Function NetworkUserName () As String Dim iStringLength As Integer Dim sString As String * 255 iStringLength = Len(sString) sString = String$(iStringLength, 0) If WNetGetUser(sString, iStringLength) = 0 Then NetworkUserName = Left$(sString, iStringLength) Else NetworkUserName = "Unknown" End If End Function
G Guest May 23, 2007 #3 Arvin, thanks for response Where is WNerGetUser defined. If I use function as you described, get Compile Error : Function or Sub not defined (on WNetGetUser) TIA again
Arvin, thanks for response Where is WNerGetUser defined. If I use function as you described, get Compile Error : Function or Sub not defined (on WNetGetUser) TIA again
A Arvin Meyer [MVP] May 23, 2007 #4 Sorry, you do need an API declaration for that: Declare Function WNetGetUser Lib "user" (ByVal sUser As String, nBufferSize As Integer) As Integer Here's the documentation: http://msdn2.microsoft.com/en-us/library/aa385476.aspx -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com
Sorry, you do need an API declaration for that: Declare Function WNetGetUser Lib "user" (ByVal sUser As String, nBufferSize As Integer) As Integer Here's the documentation: http://msdn2.microsoft.com/en-us/library/aa385476.aspx -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com