Current_user

L

Lara

How to find current_user logged on via
access to sql server.
select current_user doesn't work, access is looking for
from clause.

select current_user from sysusers works
in sql server, but I don't know how to link this table
in Access.

Or is there any way for me to run sql statements
without linking a table in Access?

Thanks in advance,
-Lara
 
L

Lara

Van,

Thank you, I am trying to use the result of this
query as a variable in other queries and also reports.
I tried using it as

Dim sSQL As String
Dim Usr As String
sSQL = "SELECT CURRENT_USER"
Me.RecordSource = sSQL
Me.Requery
Usr = Me.RecordSource

But this doesn't work, I get syntax error for select.
Any ideas on how to tackle this?

Thanks for your help!
 
J

J. Clay

Lara, in our case, we are using Windows Authentication and Current_User
returns "dbo". To return the user name I am using System _User which
returns the Domain/NTUser.

My suggestion is to use a stored procedure or a function to return the user
name. Within the stored procedure you can parse out just the user name from
the string and return that to your app.

HTH,
J. Clay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top