Re: apiGetUserName Lib "advapi32.dll"
- From: Me <Me@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 10 Aug 2006 13:21:02 -0700
Douglas,
Here is what I tried -
When I run the following query in 'Query Analyzer', I get the desired result -
select user, current_user, session_user,system_user
However, when I run the same in Acces Database I get error since it doesn't
recognize from where its supposed to retrieve the data.
So I linked the sysusers table and modified the query in Access as follows -
SELECT name, *
FROM sysusers
WHERE name=session_user;
It doesn't recognize session_user and it asks for session_user.
Do you have other suggestions?
Thank you,
-Me
"Douglas J. Steele" wrote:
You need to get that from SQL Server, not from WIndows..
You can create a pass-through query that retrieves the name from SQL Server.
Unfortunately, I can never remember which keyword you need to use: it's one
of USER_NAME, CURRENT_USER, SESSION_USER or SYSTEM_USER.
Go into SQL Server and run the following:
SELECT USER_NAME(), CURRENT_USER, SESSION_USER, SYSTEM_USER
Which of those 4 is what you're looking for?
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Me" <Me@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:539CD436-C0F1-4881-AE63-8900CE36EF4C@xxxxxxxxxxxxxxxx
I have a function apiGetUserName that uses - Lib "advapi32.dll"database.
to get me the username.
But this gets me the windows username with which I am logged on to the
computer.
I want to get the username with which I am logged on to SQL server
Please note its not the access database login, but sql server login.
Thank you very much in advance,
-Me
- Follow-Ups:
- Re: apiGetUserName Lib "advapi32.dll"
- From: Terry Kreft
- Re: apiGetUserName Lib "advapi32.dll"
- References:
- Re: apiGetUserName Lib "advapi32.dll"
- From: Douglas J. Steele
- Re: apiGetUserName Lib "advapi32.dll"
- Prev by Date: Re: Auto Setting payment records to 0 for unpaid invoices
- Next by Date: Re: Picking up values from an earlier record
- Previous by thread: Re: apiGetUserName Lib "advapi32.dll"
- Next by thread: Re: apiGetUserName Lib "advapi32.dll"
- Index(es):
Relevant Pages
|
Loading