select user from ....

  • Thread starter Thread starter William
  • Start date Start date
W

William

Help please. In an Oracle database I can identify the current user with the
statement "SELECT USER FROM DUAL;" Can I do something similar in MS Access?
 
as another option, you can use VB code to get the Windows Username of
the person logged into the computer.

here is function that i have been using that i found online.

' Code Courtesy of
' Dev Ashish
'
Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If (lngX > 0) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function
 
you also need to declare this first, on top of the VB code, so it
knows what dll to look at.


Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long



regards
 

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

Back
Top