Re: apiGetUserName Lib "advapi32.dll"
- From: "Terry Kreft" <terry.kreft@xxxxxxxxx>
- Date: Thu, 10 Aug 2006 23:51:03 +0100
I've just tried what Doug suggested and it worked fine.
I suspect you missed the phrase "pass-through".
You create a pass-through query so that the SQL is executed on the SQL
Server not by Access.
--
Terry Kreft
"Me" <Me@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CD81FE4C-5540-44CF-9B4F-EA48A51E0A12@xxxxxxxxxxxxxxxx
Douglas,result -
Here is what I tried -
When I run the following query in 'Query Analyzer', I get the desired
select user, current_user, session_user,system_userdoesn't
However, when I run the same in Acces Database I get error since it
recognize from where its supposed to retrieve the data.follows -
So I linked the sysusers table and modified the query in Access as
Server.
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
oneUnfortunately, I can never remember which keyword you need to use: it's
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:
- References:
- Re: apiGetUserName Lib "advapi32.dll"
- From: Douglas J. Steele
- Re: apiGetUserName Lib "advapi32.dll"
- From: Me
- Re: apiGetUserName Lib "advapi32.dll"
- Prev by Date: Re: Saving Back-End Data As mdf
- Next by Date: Detect is record is new
- Previous by thread: Re: apiGetUserName Lib "advapi32.dll"
- Next by thread: Re: apiGetUserName Lib "advapi32.dll"
- Index(es):
Relevant Pages
|