Re: Getting NT User Login Names from Access 2000 or 2003
- From: "Michael Miller" <MichaelMiller@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 22 Jun 2005 13:52:04 -0700
I tried to post the code:
Option Compare Database
Private Declare Function apiGetUserName Lib "C:\WINNT\system32\advapi32.dll"
Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Form_Open(Cancel As Integer)
Dim strUserName As String
strUserName = fOSUserName()
MsgBox strUserName
End Sub
and got an error in my reply to you and the reply has no code.
Tryng the code, above, again.
--
MichaelM
"Jeff Conrad" wrote:
> Humor me here.
>
> Create a new blank form and put this code in the Open event.
>
> Private Sub Form_Open(Cancel As Integer)
> MsgBox fOSUserName()
> End Sub
>
> What does the message box say?
> Any extra spaces?
>
> --
> Jeff Conrad
> Access Junkie
> http://home.bendbroadband.com/conradsystems/accessjunkie.html
> http://www.access.qbuilt.com/html/articles.html
>
> "Michael Miller" wrote in message:
> news:3B25DD23-EBE4-4137-B56D-C2605A855261@xxxxxxxxxxxxxxxx
>
> > Nothing is missing and it does find MMILLER, but has over 200 spaces after it.
> > The additional spaces will not allow it to be assigned to a field.
> >
> > This code does match the user name with a string value tho, even given the
> > spaces:
> > Select Case LCase(fOSUserName())
> >
> > Case "mmiller"
> > cmdDeveloperClose.Visible = True
> > cmdStarsUpdate.Visible = True
> > lblHello.Visible = True
> > lblHello.Caption = lblHello.Caption & " Michael"
> >
> > --
> > MichaelM
> >
> >
> > "Jeff Conrad" wrote:
> >
> > > Sounds like maybe a References problem. See:
> > >
> > > http://home.bendbroadband.com/conradsystems/accessjunkie/references.html
> > >
> > > Post back with results.
> > > --
> > > Jeff Conrad
> > > Access Junkie
> > > http://home.bendbroadband.com/conradsystems/accessjunkie.html
> > > http://www.access.qbuilt.com/html/articles.html
> > >
> > > "Michael Miller" wrote in message:
> > > news:2A04C5B6-B320-48AC-AFA7-96FE3B0F571F@xxxxxxxxxxxxxxxx
> > >
> > > > I have a function called fOSUserName, that I found, to get the login name of
> > > > the person, when they open my main form.
> > >
> > > [code snipped]
> > >
> > > > Problem is that it's returning mmiller followed by a bunch of square boxes.
> > > > The Left$ (in the code) and a try of Trim and a LTrim(RTrim()) is not fixing
> > > > it. When I try to assign it to a field in a log table, it always says that
> > > > my data is too big for the field.
> > > > When I assign it to a label, it shows up fine, as the boxes are not visible.
> > >
> > >
> > >
>
>
>
.
- References:
- Getting NT User Login Names from Access 2000 or 2003
- From: Michael Miller
- Re: Getting NT User Login Names from Access 2000 or 2003
- From: Jeff Conrad
- Re: Getting NT User Login Names from Access 2000 or 2003
- From: Michael Miller
- Re: Getting NT User Login Names from Access 2000 or 2003
- From: Jeff Conrad
- Getting NT User Login Names from Access 2000 or 2003
- Prev by Date: Re: Getting NT User Login Names from Access 2000 or 2003
- Next by Date: Re: Help with inventory stock level
- Previous by thread: Re: Getting NT User Login Names from Access 2000 or 2003
- Next by thread: Re: Getting NT User Login Names from Access 2000 or 2003
- Index(es):
Relevant Pages
|