Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to use pc logon, then I am unsure what to do with it

Status
Not open for further replies.

ggreg

Programmer
Mar 9, 2001
201
US
I am not sure how to tackle this problem but I know there is a solution.
What I do know:
I need to get a person pc logon as they enter the database.

I know I will put there logons in a table so I will have a list of everyone who should be using the database.

The reason for needing there logons is to filter what they are able to see.

I will know how to set up the filter query to filter what they see.

now what I am not sure about:
how do I get them pc logon as they enter the database and
what do I do with it? Do I some how insert it into my filter query or do I place it into a table that will be use in the query?

so what do I do and thanks for any help coming my way


 
Hi

Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function bisOSUserName() As String
' Returns id of Logged in User
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
bisOSUserName = Left(strUserName, lngLen - 1)
Else
bisOSUserName = &quot;&quot;
End If
End Function

will get you logged on user (network User id), as to what you do with it to achieve your objective there are numerous possibilities

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top