get the userid in a project

L

lefrench

Hi, thanks in advance for the help, In a project I want to get the userid
with the client is accesing the MSDE, if I use currenuser command I alway get
admin, even if I open the datebase with difference userid

Any Advice, thanks
 
T

Tim Ferguson

Hi, thanks in advance for the help, In a project I want to get the
userid with the client is accesing the MSDE, if I use currenuser
command I alway get admin, even if I open the datebase with difference
userid

SELECT SYSTEM_USER


This should work from an Access project:


Public Sub WhoAmI()
Dim adoSQL As String
Dim rst As ADODB.Recordset

' this is how to get it
adoSQL = "SELECT SYSTEM_USER"

' look it up
Set rst = New ADODB.Recordset
rst.Open adoSQL, CurrentProject.Connection, _
adOpenForwardOnly, adLockReadOnly, _
adCmdText

' and do something useful with the result...
MsgBox rst.Fields(0), vbInformation, "Who am I?"

End Sub
 
Top