473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Getting windows user name

(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
5 8100
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

"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
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

"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: john_williams_800 | last post by:
Hi; I am writing an html page that will live on one server in an ms windows network, but access pictures from a directory on another ms windows server in the network. I know in html the...
0
by: Juan Manuel G?mez Ramos | last post by:
Hello: I'm using a C# component to manage windows tasks. It allows task creation providing an account name and password. The operating system will only execute the task if the account...
4
by: Mark | last post by:
hey, i'm trying to get the current windows user and the groups they are in. Intergrated windows auth on and annoymous access turned off on IIS. However when trying to compile the following code...
4
by: Nick | last post by:
I'm developing an intranet app, and want to get the current user name for logging purposes. I've turned off anonymous access, and turned on windows authentication in the IIS config. The apps...
2
by: Scott M. Lyon | last post by:
I'm having some strange problems with a VB.NET application that I support. The application currently uses SystemInformation.UserName() and SystemInformation.UserDomainName() to determine who is...
13
by: Steve Enzer | last post by:
How can I get the login name of the user currently logged into Windows as a string? Thanks, Steve Enzer
1
by: iwdu15 | last post by:
hi, how can i get the icon associated with a certain file type? thanks -- -iwdu15
4
by: shashank kadge | last post by:
hi all, i am trying to get local admin users and groups on a windows server. here is the C# code that i am using...
0
by: TG | last post by:
Hi! Once again I have hit a brick wall here. I have a combobox in which the user types the server name and then clicks on button 'CONNECT' to populate the next combobox which contains all the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.