Connecting Tech Pros Worldwide Forums | Help | Site Map

might be a little over the ability of access but can I get user name from system?

sparks
Guest
 
Posts: n/a
#1: Nov 12 '05
yes I tried DBEngine.Workspaces(0).UserName
and this gives me a name of the current user of access.
admin in my case

but can I get the user login name and store it in a table?
the login name of the computer that is

thank you for any help with this
we have a bunch of databases going out on laptops..
multi site info gathering with multi users at each site
we need to know who opened acces and put in what.
Nope they refuse to "WASTE" time putting in a recorderID
we try to explain these things to them but to no avail.

thank you again for any help

ps I went to ms and their listings show
http://support.microsoft.com/default...B;en-us;198755
how to do this same thing in access2k but it gives the same results
computer_name login_name ??
littlecomputer admin

login_name is blank

Jerry



Lyle Fairfield
Guest
 
Posts: n/a
#2: Nov 12 '05

re: might be a little over the ability of access but can I get user name from system?


sparks <sparks@here.com> wrote in news:6j3lrvgoopte3h8f0a4db6e9kuo5pjcbuo@
4ax.com:
[color=blue]
> but can I get the user login name and store it in a table?
> the login name of the computer that is[/color]

Maybe this, but I'm not 100% sure what you want:

Option Explicit

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

Private Sub TestUserName()
MsgBox UserName
End Sub

Public Function UserName() As String
Dim BufferLength As Long
Dim Buffer As String
GetUserName Buffer, BufferLength
Buffer = String(BufferLength, " ")
GetUserName Buffer, BufferLength
UserName = Left(Buffer, BufferLength - 1)
End Function

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
TC
Guest
 
Posts: n/a
#3: Nov 12 '05

re: might be a little over the ability of access but can I get user name from system?


As Lyle said, use the windows GetUserName function to return the logon-name
of the person currently logged-on to the PC. Add a field to the your
database table, for storing that. Have the BeforeUpdate event of your form,
copy the logon-name (which it gets by calling GetUserName) into that field.
Voila: the logon name of the first person to create the record, or the last
person to alter it, will be stored in the record.

Of course, that won't help with >deletions< ...

HTH,
TC


"sparks" <sparks@here.com> wrote in message
news:6j3lrvgoopte3h8f0a4db6e9kuo5pjcbuo@4ax.com...[color=blue]
> yes I tried DBEngine.Workspaces(0).UserName
> and this gives me a name of the current user of access.
> admin in my case
>
> but can I get the user login name and store it in a table?
> the login name of the computer that is
>
> thank you for any help with this
> we have a bunch of databases going out on laptops..
> multi site info gathering with multi users at each site
> we need to know who opened acces and put in what.
> Nope they refuse to "WASTE" time putting in a recorderID
> we try to explain these things to them but to no avail.
>
> thank you again for any help
>
> ps I went to ms and their listings show
> http://support.microsoft.com/default...B;en-us;198755
> how to do this same thing in access2k but it gives the same results
> computer_name login_name ??
> littlecomputer admin
>
> login_name is blank
>
> Jerry
>
>[/color]


sparks
Guest
 
Posts: n/a
#4: Nov 12 '05

re: might be a little over the ability of access but can I get user name from system?


Thank you very much for all your help.
Now that it does this " OH NO not that lets try " ROFL


thanks again for your help

jerry


On Wed, 19 Nov 2003 14:00:32 +1200, "TC" <a@b.c.d> wrote:
[color=blue]
>As Lyle said, use the windows GetUserName function to return the logon-name
>of the person currently logged-on to the PC. Add a field to the your
>database table, for storing that. Have the BeforeUpdate event of your form,
>copy the logon-name (which it gets by calling GetUserName) into that field.
>Voila: the logon name of the first person to create the record, or the last
>person to alter it, will be stored in the record.
>
>Of course, that won't help with >deletions< ...
>
>HTH,
>TC
>
>
>"sparks" <sparks@here.com> wrote in message
>news:6j3lrvgoopte3h8f0a4db6e9kuo5pjcbuo@4ax.com.. .[color=green]
>> yes I tried DBEngine.Workspaces(0).UserName
>> and this gives me a name of the current user of access.
>> admin in my case
>>
>> but can I get the user login name and store it in a table?
>> the login name of the computer that is
>>
>> thank you for any help with this
>> we have a bunch of databases going out on laptops..
>> multi site info gathering with multi users at each site
>> we need to know who opened acces and put in what.
>> Nope they refuse to "WASTE" time putting in a recorderID
>> we try to explain these things to them but to no avail.
>>
>> thank you again for any help
>>
>> ps I went to ms and their listings show
>> http://support.microsoft.com/default...B;en-us;198755
>> how to do this same thing in access2k but it gives the same results
>> computer_name login_name ??
>> littlecomputer admin
>>
>> login_name is blank
>>
>> Jerry
>>
>>[/color]
>[/color]

Closed Thread