Accessing oracle pseudo columns in SQL within Access 2003

  • Thread starter Thread starter jeremy
  • Start date Start date
J

jeremy

Hi folks,

The following SQL statement is valid in Oracle:

select user from dual;

It returns the name of the user (schema) to which the client program
is connected.

How do I refer to the pseudo-column "user" within Access 2003? When I
code something similar the user is prompted to enter a value for the
user - i.e. that Access thinks that the reference is to a user-
supplied value.

Many thanks for any help!
 
Hi folks,

The following SQL statement is valid in Oracle:

select user from dual;

It returns the name of the user (schema) to which the client program
is connected.

How do I refer to the pseudo-column "user" within Access 2003? When I
code something similar the user is prompted to enter a value for the
user - i.e. that Access thinks that the reference is to a user-
supplied value.

Many thanks for any help!

CurrentUser() but that assumes you have implemented security. If you
want the login name of the user,



(Q) How do I retrieve the UserName with which the user is logged into
the network?

(A) Paste the following code in a new module and call the function
fOSUserName.

'******************** Code Start **************************
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

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
'******************** Code End **************************
 
Back
Top