Re: Logon

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Alvin Hansen (AlvinHansen_at_discussions.microsoft.com)
Date: 01/18/05


Date: Tue, 18 Jan 2005 10:55:04 -0800

Thanks I try it

Alvin

"Joe Smith" skrev:

> I haven't done VBA/VB in a while, but try this
>
> in the form declarartions or module, use this line
>
> Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
> (ByVal lpBuffer As String, nSize As Long) As Long
>
> Then somewhere in your program, here are the lines that should work
>
> Dim sTest As String * 128
> GetUserName sTest, Len(sTest)
> MsgBox sTest
>
> Hope that helps
>
> Steve
>
> "Alvin Hansen" <AlvinHansen@discussions.microsoft.com> wrote in message
> news:1D568023-B266-40C6-803C-04E6C47E396D@microsoft.com...
> > Hi!!
> >
> > I try to find my username
> > i logon to a server with a name
> > but on my Pc i am "Admin" so if i use
> > currentusername i get "admin" and not my name i
> > use to logon to the server, is there a way to grab the username??
> >
> > Best regards alvin
> >
>
>
>


Quantcast