By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,829 Members | 1,828 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,829 IT Pros & Developers. It's quick & easy.

Getting windows user name

P: n/a
(This was also posted to comp.database.ms-access before I realized this was
the hep group.)

Lets say that my WinXP computer has two users: Michael and Kathryn. One or
the other logs into the computer and opens up an Access database (I happen
to be using 2002). There is no security on the database -- just click on the
shortcut and you're in.

I want to be able to determine who opened that database by knowing who
logged into the computer.

Is there a way to get the windows user name?

I have another question, and this one may be a bit off-topic, but I'll run
it up the flagpole.

I want to leave the above-named database open all the time, such that
whenever anybody logs in at the windows login screen, the database will be
up and running. In the actual application there may be as many as twenty
people accessing the same application, and I don't want twenty instances of
the program running -- one for each user. Can I have that database display
on the screen of all users? (Specifically, I would like to use Windows Fast
User Switching to change users.)

In most situations, I could resolve these issues using Access' security
features. This is a unique application, though, and the users won't be able
to log into the database themselves.

Thanks!

Mike

Nov 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Windows user name:
http://www.mvps.org/access/api/api0008.htm

The multi-user approach you suggest is not recommended. Instead, split the
database, and give each user their own local copy of the front end. More
info on this approach:
http://members.iinet.net.au/~allenbrowne/ser-01.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mike Turco" <mi*******@yahoo-nospam4me.com> wrote in message
news:aGWYc.174518$sh.173430@fed1read06...
(This was also posted to comp.database.ms-access before I realized this
was
the hep group.)

Lets say that my WinXP computer has two users: Michael and Kathryn. One or
the other logs into the computer and opens up an Access database (I happen
to be using 2002). There is no security on the database -- just click on
the
shortcut and you're in.

I want to be able to determine who opened that database by knowing who
logged into the computer.

Is there a way to get the windows user name?

I have another question, and this one may be a bit off-topic, but I'll run
it up the flagpole.

I want to leave the above-named database open all the time, such that
whenever anybody logs in at the windows login screen, the database will be
up and running. In the actual application there may be as many as twenty
people accessing the same application, and I don't want twenty instances
of
the program running -- one for each user. Can I have that database display
on the screen of all users? (Specifically, I would like to use Windows
Fast
User Switching to change users.)

In most situations, I could resolve these issues using Access' security
features. This is a unique application, though, and the users won't be
able
to log into the database themselves.

Nov 13 '05 #2

P: n/a

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:41**********************@per-qv1-newsreader-01.iinet.net.au...
Windows user name:
http://www.mvps.org/access/api/api0008.htm

The multi-user approach you suggest is not recommended. Instead, split the
database, and give each user their own local copy of the front end. More
info on this approach:
http://members.iinet.net.au/~allenbrowne/ser-01.html


Hi Allen,

I'm not sure that splitting the database is the way to go. I have a single
computer that will be used by several different people. I want to use Fast
User Switching to log people in-and-out of the system. The system gets a lot
of use and I don't want the lines to get any worse. I can't create a network
to reduce wait time because the database controls a single, unique
instrument. Having users log in-and-out of Access isn't an option because I
have to close and re-open Access, which is time consuming. I want to use
Windows fast user switching feature if I can.

I am reading your post as suggesting that each user have their own front
end. That would mean that as many as twenty users each have a copy of Access
open. That sounds, to me, like a pretty big load on the computer.

Thanks for your help.

Mike
Nov 13 '05 #3

P: n/a
Mike Turco wrote:
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:41**********************@per-qv1-newsreader-01.iinet.net.au...
Windows user name:
http://www.mvps.org/access/api/api0008.htm

The multi-user approach you suggest is not recommended. Instead, split the
database, and give each user their own local copy of the front end. More
info on this approach:
http://members.iinet.net.au/~allenbrowne/ser-01.html

Hi Allen,

I'm not sure that splitting the database is the way to go. I have a single
computer that will be used by several different people. I want to use Fast
User Switching to log people in-and-out of the system. The system gets a lot
of use and I don't want the lines to get any worse. I can't create a network
to reduce wait time because the database controls a single, unique
instrument. Having users log in-and-out of Access isn't an option because I
have to close and re-open Access, which is time consuming. I want to use
Windows fast user switching feature if I can.

I am reading your post as suggesting that each user have their own front
end. That would mean that as many as twenty users each have a copy of Access
open. That sounds, to me, like a pretty big load on the computer.

Thanks for your help.

Mike

Prepare yourself, it doesn't work like that, each fast switched user
will have their own copy of Access loaded into memory so even if you can
get around any locking problems of them all opening the same database
directly they will still be using nearly 100MB RAM just for the logon
session and a copy of Access with no database loaded (I just tested this
under XP, the second msaccess.exe is only using 2MB, couldn't open the
same database BTW), loadin a database will increase this useage,
regardless of if it's a shared or separate copy as it will be another
instance.

What I did in a similar situation, 4 guys in a warehouse, 1 computer (A
P75 with Win 3.11, 95 was still coming of age) was to implement my own
security, just user name and password when entering a form. I did this
for the reason you specify, too long to load up Access for each user.

--

\\\\\\
\\ \\ Windows is searching
\ \ For your sig.
\ \ Please Wait.
\__\

Nov 13 '05 #4

P: n/a

"Trevor Best" <nospam@localhost> wrote in message
news:41***********************@auth.uk.news.easyne t.net...
Mike Turco wrote:
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:41**********************@per-qv1-newsreader-01.iinet.net.au...
Windows user name:
http://www.mvps.org/access/api/api0008.htm

The multi-user approach you suggest is not recommended. Instead, split thedatabase, and give each user their own local copy of the front end. More
info on this approach:
http://members.iinet.net.au/~allenbrowne/ser-01.html

Hi Allen,

I'm not sure that splitting the database is the way to go. I have a single computer that will be used by several different people. I want to use Fast User Switching to log people in-and-out of the system. The system gets a lot of use and I don't want the lines to get any worse. I can't create a network to reduce wait time because the database controls a single, unique
instrument. Having users log in-and-out of Access isn't an option because I have to close and re-open Access, which is time consuming. I want to use
Windows fast user switching feature if I can.

I am reading your post as suggesting that each user have their own front
end. That would mean that as many as twenty users each have a copy of Access open. That sounds, to me, like a pretty big load on the computer.

Thanks for your help.

Mike

Prepare yourself, it doesn't work like that, each fast switched user
will have their own copy of Access loaded into memory so even if you can
get around any locking problems of them all opening the same database
directly they will still be using nearly 100MB RAM just for the logon
session and a copy of Access with no database loaded (I just tested this
under XP, the second msaccess.exe is only using 2MB, couldn't open the
same database BTW), loadin a database will increase this useage,
regardless of if it's a shared or separate copy as it will be another
instance.

What I did in a similar situation, 4 guys in a warehouse, 1 computer (A
P75 with Win 3.11, 95 was still coming of age) was to implement my own
security, just user name and password when entering a form. I did this
for the reason you specify, too long to load up Access for each user.


What you're saying makes sense.

Another issue here is that the database controls an instrument through USB,
and that may add a whole new level of headache if I create a setup that is
more complex than what it needs to be.

Thanks,

Mike
Nov 13 '05 #5

P: n/a
If you are still interested in how to get the current logged on user
the following code will do so.

'Declared Globally
Private Declare Function GetUserNameAPI Lib "advapi32.dll" _
Alias "GetUserNameA" (ByVal lpbuffer As String, _
nSize As Long) As Long

Public Function GetUserName() As String
Dim sBuffer As String
Dim lSize As Long

' Space for dll parameters
sBuffer = Space$(255)
lSize = Len(sBuffer)

Call GetUserNameAPI(sBuffer, lSize)

If lSize > 0 Then
' Remove empty spaces
GetUserName = Left$(sBuffer, lSize - 1)
Else
' Return empty if no user is found
GetUserName = vbNullString
End If

End Function

"Mike Turco" <mi*******@yahoo-nospam4me.com> wrote in message news:<aGWYc.174518$sh.173430@fed1read06>...
(This was also posted to comp.database.ms-access before I realized this was
the hep group.)

Lets say that my WinXP computer has two users: Michael and Kathryn. One or
the other logs into the computer and opens up an Access database (I happen
to be using 2002). There is no security on the database -- just click on the
shortcut and you're in.

I want to be able to determine who opened that database by knowing who
logged into the computer.

Is there a way to get the windows user name?

I have another question, and this one may be a bit off-topic, but I'll run
it up the flagpole.

I want to leave the above-named database open all the time, such that
whenever anybody logs in at the windows login screen, the database will be
up and running. In the actual application there may be as many as twenty
people accessing the same application, and I don't want twenty instances of
the program running -- one for each user. Can I have that database display
on the screen of all users? (Specifically, I would like to use Windows Fast
User Switching to change users.)

In most situations, I could resolve these issues using Access' security
features. This is a unique application, though, and the users won't be able
to log into the database themselves.

Thanks!

Mike

Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.