B
Br1an_g
heres how to get the current NT sign on (from knowledge
base):
function goes in a module
the rest in the module of the form (prob switchboard)
then you can do a select statment to retrieve the user
permissions from your table where lpUserName=tblUserName
Budget/Expense tracking and PO preparation deal now), I'd
like to compare the NT userID from the "client PC" with a
table of users who are allowed to use the application.
I'm not so much (at the moment) concerned about user
levels (of course, I'll be administrator), but I will need
to compare to a table of users...
seen, etc.
base):
function goes in a module
the rest in the module of the form (prob switchboard)
then you can do a select statment to retrieve the user
permissions from your table where lpUserName=tblUserName
Code:
' Declare for call to mpr.dll.
Declare Function WNetGetUser Lib "mpr.dll" _
Alias "WNetGetUserA" (ByVal lpName As String, _
ByVal lpUserName As String, lpnLength As Long) As
Long
Const NoError = 0 'The Function call was
successful
Sub GetUserName()
' Buffer size for the return string.
Const lpnLength As Integer = 255
' Get return buffer space.
Dim status As Integer
' For getting user information.
Dim lpName, lpUserName As String
' Assign the buffer size constant to lpUserName.
lpUserName = Space$(lpnLength + 1)
' Get the log-on name of the person using product.
status = WNetGetUser(lpName, lpUserName, lpnLength)
' See whether error occurred.
If status = NoError Then
' This line removes the null character. Strings
in C are null-
' terminated. Strings in Visual Basic are not
null-terminated.
' The null character must be removed from the C
strings to be used
' cleanly in Visual Basic.
lpUserName = Left$(lpUserName, InStr(lpUserName,
Chr(0)) - 1)
Else
' An error occurred.
MsgBox "Unable to get the name."
End
End If
' Display the name of the person logged on to the
machine.
MsgBox "The person logged on this machine is: " &
lpUserName
End Sub
(no longer the Labor Standards Request - I'm doing a-----Original Message-----
Good morning,
Rather than requiring users to logon to a new database
Budget/Expense tracking and PO preparation deal now), I'd
like to compare the NT userID from the "client PC" with a
table of users who are allowed to use the application.
I'm not so much (at the moment) concerned about user
levels (of course, I'll be administrator), but I will need
to compare to a table of users...
NT IDs), then I can allow or not allow certain menus to beIf I can set userlevel by a usertable (with the list of
seen, etc.
posting here, then I will go to the AccessWeb site as well.I've checked the ng archives and found nothing. I'm