UserName

GetReel

Registered User.
Local time
Today, 21:48
Joined
May 22, 2003
Messages
67
Can someone tell where I need to insert the Username.

I want the DB to insert the user who is generating the comments in the comments memo field.

How do I get the to automatically insert the current user.?

Me.Comments = Me.Comments & vbCrLf & " Date of Comment:" & Date & " - " & Me.txtCommentsAdd 'adds and new comments"
 
How are capturing the current username? Is it from a custom logon form in your project or are you wanting to capture the NT username?
 
Hi calvin,

I just want the NT username.
Is this do-able

If it makes a difference, I have this stored a module.


Private Declare Function GetComputerNameA Lib "kernel32" (ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function GetCurrentUserName() As String
On Error GoTo Err_GetCurrentUserName
Dim lpBuff As String * 25
Dim ret As Long, UserName As String
ret = GetUserName(lpBuff, 25)
UserName = left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
GetCurrentUserName = UserName & ""

Exit_GetCurrentUserName:
Exit Function

Err_GetCurrentUserName:
MsgBox Err.Description
Resume Exit_GetCurrentUserName
End Function
 
Last edited:
Certainly, have you searched this forum for "CurrentUser", if not I suggest you do that first, there are lots of threads already on this subject and believe it or not it is not hard to do. If you still have questions I or someone else will be around with answers.:)
 
I just read your ammended post, if you already have GetCurrentUserName api function then try this:
Code:
Me.Comments = Me.Comments & vbCrLf & " Date of Comment:" & Date & " - " & GetCurrentUserName & " - " & Me.txtCommentsAdd 'adds and new comments"
 
Thanks,

I'll do a search. The only reasons that I posted my question was that I did a one stage manage to insert the UserName but removed it becuase at the time a felt it was necessary. Now I have completely forgotton how I did it.

I wish I had a refresh button..hehe
 
awesone dude!!

I was using GetUserName!!!!! instead if GetCurrentUserName

I nearly had it!!

Thanks for your time :-)
 

Users who are viewing this thread

Back
Top Bottom