Retrieving Novell NetWare username and passing it to a label

Posted on 2003-03-05
Medium Priority
Last Modified: 2012-06-22
There is another thread here somewhere that was asking how he could retrieve the novell network username with 2000/XP machines (i can only retrive the local machine username at this point) and it was agreed the best method was to use:
Debug.Print Environ("nwusername")

However, being the beginner that i am, i can't get this value to display anywhere. What i want to do is use that line of code to get the username and then pass the value to a label to be displayed on my form. I hope this makes sense (it doesn't make much to me)? Even if i can get the value into a variable or something i can go from there.

Question by:marzi
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 41

Accepted Solution

shanesuebsahakarn earned 200 total points
ID: 8079509
You can use some code like this in the OnOpen event of the form:
Me!MyLabel.Caption = environ("nwusername")
LVL 18

Expert Comment

ID: 8080069
Try this:

Declare Function WNetGetUser& Lib "mpr.dll" Alias "WNetGetUserA" (ByVal lpName$, ByVal lpUserName$, BufLen&)

Public Function GetNovellUserID()
    Dim lpName As String, NovellUserLoginID As String
    NovellUserLoginID = Space$(55)
    WNetGetUser& lpName$, NovellUserLoginID, Len(NovellUserLoginID)
    GetNovellUserID = Left$(NovellUserLoginID, InStr(NovellUserLoginID, Chr$(0)) - 1)
End Function

Private Sub ShowMe()

    MsgBox GetNovellUserID()
End Sub

Author Comment

ID: 8083994
I'm not overly skilled in vb... but i can gaurantee you i should have really something other than debug.print should could equal the variable. I was thinking of it as a whole statement... pretty stupid :-)

Thanks shane... you right on the $$$.

Author Comment

ID: 8084002
That meant to say... but i can gaurantee you i should have realised something other than debug.print can equal the variable...

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question