Re: apiGetUserName Lib "advapi32.dll"
- From: "Terry Kreft" <terry.kreft@xxxxxxxxx>
- Date: Fri, 11 Aug 2006 19:50:38 +0100
If you include those in your ODBC string then it shouldn't prompt you the
relevant keys are UID= and PWD= .
To do this with the user name and password your users enter at login you
would need to capture those details and then alter the connect string
property of the query.
--
Terry Kreft
"Me" <Me@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:EE545EC2-EAA7-45B8-8F0E-98A3551AB275@xxxxxxxxxxxxxxxx
Hi Terry,query,
Thanks for the reply, you are right, once I created it as pass-thru'
it worked.for
But the problem is every time I run this query, it brings up the to ODBC
datasource settings to link with the DATA SOURCE entry and then asks me
userid/pwd.it's
Is there any way to avoid it?
Upon launch of this access database, users enter their userid/pwd. Then
I expect the pass-thru' query we discussed should give me the username
instead of asking again.
Thank you,
-Me
"Terry Kreft" wrote:
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
Unfortunately, I can never remember which keyword you need to use:
theone
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"
to get me the username.
But this gets me the windows username with which I am logged on to
login.computer.database.
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
Thank you very much in advance,
-Me
.
- References:
- Re: apiGetUserName Lib "advapi32.dll"
- From: Douglas J. Steele
- Re: apiGetUserName Lib "advapi32.dll"
- From: Me
- Re: apiGetUserName Lib "advapi32.dll"
- From: Terry Kreft
- Re: apiGetUserName Lib "advapi32.dll"
- From: Me
- Re: apiGetUserName Lib "advapi32.dll"
- Prev by Date: Re: Blank fields in a filter are not showing
- Next by Date: Re: "Microsoft Access: Overflow" - displays on opening of form?
- Previous by thread: Re: apiGetUserName Lib "advapi32.dll"
- Next by thread: Re: Form_Before_Update event being prematurely triggered
- Index(es):
Relevant Pages
|