' Place in module general declarations Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Public Function gooduser() As Boolean Dim lngSize As Long, strBuffer As String, strUserId As String, strDir As String gooduser = True ' establish default strBuffer = Space$(255) lngSize = Len(strBuffer) Call GetUserName(strBuffer, lngSize) strBuffer = Left$(strBuffer, lngSize) strUserId = Trim$(UCase$(Replace(strBuffer, Chr$(0), ""))) If strUserId <> "Someone I want to have access" Then gooduser = False MsgBox "Unable to confirm Novell / NT User Security schema.", vbCritical, "Aborting Unauthorized Access" End If ' Make sure they are on my network strDir = Dir("\\myserver\mypublic\mysecretdir", vbDirectory) If strDir = "" Then gooduser = False MsgBox "Unable to confirm Novell / NT Machine Security schema.", vbCritical, "Aborting Unauthorized Access" End If End Function ' ***** Out in your form or wherever if not gooduser then '"do not good user stuff" end if
"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams