WB786
MIS
- Mar 14, 2002
- 610
I am using the following code to capture the login id of user:
Option Compare Database
Option Explicit
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
'inl as 1
Function GetUser() As String
Dim lpUserID As String
Dim nBuffer As Long
Dim Ret As Long
'lpUserID = String(25, 0)
lpUserID = " "
nBuffer = 25
Ret = GetUserName(lpUserID, nBuffer)
If Ret Then
GetUser$ = lpUserID$
End If
End Function
I have an employee database that the IT departments updates the info with person's login ID and stuff. I am designing a form where the records on that form should be for the person that has logged into the computer:
Currently my query does this after the user selects their name from a drop down:
[Forms]![Switchboard]![EmployeeLogin]
But I want the form to capture the loginID and then see who is logging in and pull up the employee's name for that loginID from the database and then run this query. Any ideas?? Please let me know if more info is needed. Thanks in advance.
Option Compare Database
Option Explicit
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
'inl as 1
Function GetUser() As String
Dim lpUserID As String
Dim nBuffer As Long
Dim Ret As Long
'lpUserID = String(25, 0)
lpUserID = " "
nBuffer = 25
Ret = GetUserName(lpUserID, nBuffer)
If Ret Then
GetUser$ = lpUserID$
End If
End Function
I have an employee database that the IT departments updates the info with person's login ID and stuff. I am designing a form where the records on that form should be for the person that has logged into the computer:
Currently my query does this after the user selects their name from a drop down:
[Forms]![Switchboard]![EmployeeLogin]
But I want the form to capture the loginID and then see who is logging in and pull up the employee's name for that loginID from the database and then run this query. Any ideas?? Please let me know if more info is needed. Thanks in advance.