Re: Getting NT User Login Names from Access 2000 or 2003



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.
> >
> >
> >


.



Relevant Pages

  • Re: How trigger VBScript events in VBA ?
    ... ItemAdd event working! ... Public WithEvents myMailItems As Outlook.MailItem ... Private Sub myMailItems_Open ... > use the Open event in VB/VBA by instantiating the MailItem whose ...
    (microsoft.public.outlook.program_vba)
  • Re: Bug?... Load Event Executes Twice, Open Event Does Not Execute
    ... When you mentioned that it appeared as though I was making a design change ... You don't seem to be using the open event, ... DoCmd.OpenForm "frmPrinter", acNormal,,, acFormPropertySettings ... Private Sub Form_Load ...
    (microsoft.public.access.formscoding)
  • Re: Temp Form holds previous values
    ... form isn't actually closing. ... > Private Sub Report_Open ... > ' Cancel Report if User Clicked the Cancel Button ... > ' Open event is completed ...
    (microsoft.public.access.formscoding)
  • Re: lock all fields
    ... Tried the code Ken and it compiled but didn't lock the fields for some ... Private Sub Form_Load ... potentially want to cancel the open event based on some parameter other than ... a value in a form's controls or fields. ...
    (microsoft.public.access.forms)
  • Re: Missing Operator
    ... Private Sub Form_Open ... I can't quite imagine why opening this form (which presumably is not 'MenuItems') causes the MenuItems form to move to a particular record, the ID of which was already showing on the form itself - but I assume you know what you are doing there. ... with the right value during the Open event. ...
    (microsoft.public.access.forms)

Loading