Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 23rd, 2006, 05:05 PM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default user logged

Hy there!
Could someone help me here please.
Is there any code to use in Access 2003 where I can get the username of the user Logged?
I've got one for Access 97 but now my boss is instaling Access 2003 and after tested it wasnt work. Can someone help me Please. Thanks

Jony Bravo

Reply With Quote
  #2 (permalink)  
Old May 24th, 2006, 07:50 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

What code do you have for 97?

mmcdonal
Reply With Quote
  #3 (permalink)  
Old May 24th, 2006, 03:59 PM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've got the following code:

Option Compare Database
Option Explicit
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Function FOSUsername() As String
    Dim lngLen As Long, lngX As Long
    Dim strUserName As String
        strUserName = String$(254, 0)
        lngLen = 255
        lngX = apiGetUserName(strUserName, lngLen)
        If (lngX > 0) Then
            FOSUsername = Left$(strUserName, lngLen - 1)
        Else
            FOSUsername = vbNullString
        End If
End Function


Thanks to help me

Reply With Quote
  #4 (permalink)  
Old May 24th, 2006, 04:06 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Here is the code that I use in 2003. I probably couldn't explain how it works, but it does :-)

Code:
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long


Public Function localUserName() As String
Dim m_myBuf As String * 25
Dim m_Val As Long, UserName As String

m_Val = GetUserName(m_myBuf, 25)
localUserName = Left(m_myBuf, InStr(m_myBuf, Chr(0)) - 1)
End Function
HTH

Mike

Mike
EchoVue.com
Reply With Quote
  #5 (permalink)  
Old May 24th, 2006, 04:29 PM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks echovue

This work perfect.

:)

Reply With Quote
  #6 (permalink)  
Old November 27th, 2006, 07:22 AM
Friend of Wrox
 
Join Date: Dec 2005
Location: CHENNAI, TAMILNADU, India.
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to anukagni Send a message via Yahoo to anukagni
Default

Hi i had taken the theard by searching i want to get the user logged details, i think this is the way to do in DB is any one explain me clearly about this from the base...



Learn as you can..
------------------------
pap...
Reply With Quote
  #7 (permalink)  
Old November 27th, 2006, 09:14 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

sU = (Environ$("Username"))

mmcdonal
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I check whether a user is logged in or out rittwick PHP Databases 1 August 19th, 2007 04:47 PM
to keep the user logged in until he sign out sarah lee ASP.NET 1.0 and 1.1 Basics 14 December 14th, 2006 11:55 AM
Username of logged in user spardoe BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 4 August 18th, 2006 01:13 AM
Getting the name of the logged on user Grahame2003 C# 2 March 4th, 2004 04:48 AM



All times are GMT -4. The time now is 12:58 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.