Using a variable within a module

Darrenc

Registered User.
Local time
Today, 18:24
Joined
Apr 30, 2004
Messages
62
I promise i've searched the boards and thought i've found the answer a couple of time, and i still can't get this to work.
I've created a module that looks up the users computer login name and then converts that name to their proper name.
Code:
Public Function LoginName()

    Dim strUser As String
    Dim strUserLogin As String

        strUserLogin = Environ("Username")
            
            Select Case strUserLogin
            
                Case "darrenc"
                    strUser = "Darren Scott"

            End Select
                         
            
End Function
The module works the way i'd expect it to.
I want to use the strUser variable to populate various text boxes spread between different forms.
I've tried various methods, and as you'll see, i think i'm way off :rolleyes:

Code:
Private Sub ExtRaisedBy_DblClick(Cancel As Integer)
    LoginName
    Me.ExtRaisedBy.Text = strUser
  
End Sub

Thanks for you time.

Darren
 
Last edited:
Searching the forum is a great way to discover and learn the answers to your Access programming questions.

Check this out for the solution I posted @ get real user name

Then you should be able to use this to populate the text box...
Code:
ExtRaisedBy = fGetFullNameOfLoggedUser
'OR
ExtRaisedBy = fGetFullNameOfLoggedUser(Environ("UserName"))
 
Thanks for your help guys, i've learnt so much since i discovered these boards.
I still have a long way to go though :D
 

Users who are viewing this thread

Back
Top Bottom