Extract First Name from Username for Welcome Screen

solrac_otos

Registered User.
Local time
Today, 00:28
Joined
Apr 4, 2014
Messages
19
Hi there. I have a module that pulls the user name in the firstname.lastname format. This is the module (module name is fosUserName):

Code:
Public Function GetUser() As String

    Dim WNet As Object

    Set WNet = CreateObject("WScript.Network")

    GetUser = WNet.UserName

    End Function

I what to add a a text box on the welcome screen that says something along the lines of Welcome firstname (from the firstname.lastname that the code above pulls) what would you like to do? I need some code that will get me all the characters left of the period that separates the firstname from the lastname.

Any help would be greatly appreciated.

-C.
 
You would need either the Mid/Left function with the combination of InStr.
Code:
? [URL="http://www.techonthenet.com/access/functions/string/mid.php"]Mid[/URL]("Paul.Eugin", 1, [URL="http://www.techonthenet.com/access/functions/string/instr.php"]InStr[/URL]("Paul.Eugin",".")-1)
Paul
 
Or
Left("Paul.Eugin",InStr("Paul.Eugin",".")-1)

Hi Paul ! What about yours meeting in London ?
Hope you (all) did have a good party. Some stories for us ?
 
Or
Left("Paul.Eugin",InStr("Paul.Eugin",".")-1)
Thought I would leave it to the OP to discover this function. ;)
Hi Paul ! What about yours meeting in London ?
Hope you (all) did have a good party. Some stories for us ?
Am doing great thanks ! Well right now, down with "Man Flu" so a bit :(

London meetup was good thanks, not many only 3 of us (again). Probably the next meetup we will have many so I will have some stories to tell ;) Maybe you should pop over too.
 

Users who are viewing this thread

Back
Top Bottom