I have a class module that will help you get the job done. why don't email me and I will forward the access modules to you? vickvickvi@hotmail.com what you are asking for is the code that will get you the user name from the log in information so you do not have to use the access security. Forget it. I pasted the class module in the email.
GOOD Luck to you.
Michael Vick
Here is the module that I believe will do what you are asking for:
Mycomputer: Class Module
Option Compare Database
Option Explicit
'*************************************************************************
'* INTERFACE *
'*************************************************************************
'Public collections
Public Drives As New Collection
'*************************************************************************
'* IMPLEMENTATION *
'*************************************************************************
'Windows structure declarations
Private Type SYSTEM_INFO
dwOemID As Long
dwPageSize As Long
lpMinimumApplicationAddress As Long
lpMaximumApplicationAddress As Long
dwActiveProcessorMask As Long
dwNumberOrfProcessors As Long
dwProcessorType As Long
dwAllocationGranularity As Long
wProcessorLevel As Integer
wProcessorRevision As Integer
End Type
Private Type OSVERSION_INFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Private Type RECT
x1 As Long
y1 As Long
x2 As Long
y2 As Long
End Type
'Windows API function declarations
Private Declare Function SwapMouseButton Lib "user32" (ByVal bSwap As Long) As Long
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As SYSTEM_INFO)
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" _
(lpVersionInformation As OSVERSION_INFO) As Long
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" _
(ByVal sBuffer As String, lSize As Long) As Long
Private Declare Function GetUserName Lib "advapi32" Alias "GetUserNameA" _
(ByVal sBuffer As String, lSize As Long) As Long
Private Declare Function timeGetTime Lib "winmm" () As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, rectangle As RECT) As Long
Private Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" _
(ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
'Windows constant declarations
Private Const SM_SWAPBUTTON = 23
Private Const PROCESSOR_INTEL_386 = 386
Private Const PROCESSOR_INTEL_486 = 486
Private Const PROCESSOR_INTEL_PENTIUM = 586
Private Const PROCESSOR_MIPS_R4000 = 4000
Private Const PROCESSOR_ALPHA_21064 = 21064
Private Const PROCESSOR_ARCHITECTURE_INTEL = 0
Private Const PROCESSOR_ARCHITECTURE_MIPS = 1
Private Const PROCESSOR_ARCHITECTURE_ALPHA = 2
Private Const PROCESSOR_ARCHITECTURE_PPC = 3
Private Const PROCESSOR_ARCHITECTURE_UNKNOWN = &HFFFF
Private Const VER_PLATFORM_WIN32s = 0
Private Const VER_PLATFORM_WIN32_WINDOWS = 1
Private Const VER_PLATFORM_WIN32_NT = 2
'Private variable declarations
Private strAccessDir As String
Private strComputerName As String
Private strUserName As String
Private typSysInfo As SYSTEM_INFO
Private typOSVersion As OSVERSION_INFO
Private lngMemoryInstalled As Long
Private lngID As Long
Private Sub Class_Initialize()
'*****************************************************************************
'* NAME: CLASS_INITIALIZE
'* PURPOSE: To initialize variables when MyComputer object is instantiated
'* ACCEPTS: Nothing
'* RETURNS: Nothing
'* AUTHOR: Rob Smith
'* DATE: 22/06/97
'* NOTES: This procedure also populates the Disks collection
'*****************************************************************************
Dim strDriveString As String
Dim intDriveLength As Integer
Dim strDrive() As String
Dim intDriveCount As Integer
Dim intPos As Integer
Dim intcounter As Integer
Dim lngBuffSize As Long
Dim typDrive As Drive
'Get OS version information
typOSVersion.dwOSVersionInfoSize = Len(typOSVersion)
GetVersionEx typOSVersion
'Get system information (e.g. processor type)
GetSystemInfo typSysInfo
'Get Access directory
strAccessDir = SysCmd(acSysCmdAccessDir)
'Get computer name
strComputerName = Space$(255)
lngBuffSize = Len(strComputerName)
If GetComputerName(strComputerName, lngBuffSize) Then
strComputerName = Left$(strComputerName, lngBuffSize)
End If
'Get user name
strUserName = Space$(255)
lngBuffSize = Len(strUserName)
If GetUserName(strUserName, lngBuffSize) Then
strUserName = Left$(strUserName, lngBuffSize - 1)
End If
'Get details of drives
strDriveString = Space$(255)
lngBuffSize = Len(strDriveString)
intDriveLength = GetLogicalDriveStrings(lngBuffSize, strDriveString)
intPos = InStr(1, strDriveString, "\"
Do While intPos <> 0
ReDim Preserve strDrive(intDriveCount)
strDrive(intDriveCount) = Mid$(strDriveString, intPos - 2, 3)
intDriveCount = intDriveCount + 1
intPos = InStr(intPos + 1, strDriveString, "\"

Loop
For intcounter = 0 To intDriveCount - 1
Set typDrive = New Drive
typDrive.Root = strDrive(intcounter)
Drives.Add typDrive
Set typDrive = Nothing
Next
lngID = timeGetTime
End Sub
Public Property Get AccessDir() As String
'*****************************************************************************
'* NAME: ACCESSDIR
'* PURPOSE: To allow the AccessDir property to be inspected
'* ACCEPTS: Nothing
'* RETURNS: A string indicating the directory in which Access is installed
'* AUTHOR: Rob Smith
'* DATE: 22/06/97
'* NOTES:
'*****************************************************************************
AccessDir = strAccessDir
End Property
Public Property Get ButtonsSwapped() As Boolean
'*****************************************************************************
'* NAME: BUTTONSSWAPPED
'* PURPOSE: To allow the ButtonsSwapped property to be inspected
'* ACCEPTS: Nothing
'* RETURNS: False if the mouse is configured for left-handed use
'* True (non-zero) otherwise
'* AUTHOR: Rob Smith
'* DATE: 22/06/97
'* NOTES:
'*****************************************************************************
ButtonsSwapped = GetSystemMetrics(SM_SWAPBUTTON)
End Property
Public Property Let ButtonsSwapped(bSwap As Boolean)
'*****************************************************************************
'* NAME: BUTTONSSWAPPED
'* PURPOSE: To allow the ButtonsSwapped property to be set
'* ACCEPTS: True (non-zero) if the mouse is to be configured for left-handed use
' False if the mouse is to be configured for (default) right-handed use
'* RETURNS: Nothing
'* AUTHOR: Rob Smith
'* DATE: 22/06/97
'* NOTES:
'*****************************************************************************
Dim lngSwap As Long
lngSwap = CLng(bSwap)
Call SwapMouseButton(lngSwap)
End Property
Public Sub SwapButtons(bSwap As Boolean)
'*****************************************************************************
'* NAME: SWAPBUTTONS
'* PURPOSE: To expose the SwapButtons method
'* ACCEPTS: True (non-zero) if the mouse is to be configured for left-handed use
' False if the mouse is to be configured for (default) right-handed use
'* RETURNS: Nothing
'* AUTHOR: Rob Smith
'* DATE: 22/06/97
'* NOTES: This provides identical functionality to the ButtonsSwapped property
'*****************************************************************************
SwapMouseButton bSwap
End Sub
Public Function SwapButtonCheck(bSwap As Boolean) As Boolean
'*****************************************************************************
'* NAME: SWAPBUTTONCHECK
'* PURPOSE: To allow the ButtonsSwapped property to be set and determine whether
'* this results in a changed mouse configuration
'* ACCEPTS: True (non-zero) if the mouse is to be configured for left-handed use
' False if the mouse is to be configured for (default) right-handed use
'* RETURNS: True if the mouse configuration changes as a result of this call;
'* False otherwise
'* AUTHOR: Rob Smith
'* DATE: 22/06/97
'* NOTES:
'*****************************************************************************
Dim bNewState As Boolean
bNewState = SwapMouseButton(bSwap)
If bNewState = bSwap Then
SwapButtonCheck = False
Else
SwapButtonCheck = True
End If
End Function
Public Property Get CPUArchitecture() As String
'*****************************************************************************
'* NAME: CPUARCHITECTURE
'* PURPOSE: To allow the CPUArchitecture property to be inspected
'* ACCEPTS: Nothing
'* RETURNS: A string indicating the type of processor installed
'* AUTHOR: Rob Smith
'* DATE: 22/06/97
'* NOTES: FOr Win95, this will always be "Intel"
'*****************************************************************************
Select Case typSysInfo.dwOemID
Case PROCESSOR_ARCHITECTURE_INTEL
CPUArchitecture = "Intel"
Case PROCESSOR_ARCHITECTURE_MIPS
CPUArchitecture = "MIPS"
Case PROCESSOR_ARCHITECTURE_ALPHA
CPUArchitecture = "Alpha"
Case PROCESSOR_ARCHITECTURE_PPC
CPUArchitecture = "PowerPC"
Case PROCESSOR_ARCHITECTURE_UNKNOWN
CPUArchitecture = "Unknown"
End Select
End Property
Public Property Get OSName() As String
'*****************************************************************************
'* NAME: OSNAME
'* PURPOSE: To allow the OSName property to be inspected
'* ACCEPTS: Nothing
'* RETURNS: A string indicating the name of the operating system installed
'* e.g. Windows NT 4.0 Build 1381
'* ~~~~~~~~~~
'* AUTHOR: Rob Smith
'* DATE: 22/06/97
'* NOTES: Further information is in the OSVersion and OSBuild properties
'*****************************************************************************
Select Case typOSVersion.dwPlatformId
Case VER_PLATFORM_WIN32_WINDOWS
OSName = "Windows 95"
Case VER_PLATFORM_WIN32_NT
OSName = "Windows NT"
End Select
End Property
Public Property Get OSVersion() As String
'*****************************************************************************
'* NAME: OSVERSION
'* PURPOSE: To allow the OSVersion property to be inspected
'* ACCEPTS: Nothing
'* RETURNS: A string indicating the version of the operating system installed
'* e.g. Windows NT 4.0 Build 1381
'* ~~~
'* AUTHOR: Rob Smith
'* DATE: 22/06/97
'* NOTES: Further information is in the OSVersion and OSBuild properties
'*****************************************************************************
OSVersion = typOSVersion.dwMajorVersion & "." & typOSVersion.dwMinorVersion
End Property
Public Property Get OSBuild() As String
'*****************************************************************************
'* NAME: OSBUILD
'* PURPOSE: To allow the OSBuild property to be inspected
'* ACCEPTS: Nothing
'* RETURNS: A string indicating the build of the operating system installed
'* e.g. Windows NT 4.0 Build 1381
'* ~~~~
'* AUTHOR: Rob Smith
'* DATE: 22/06/97
'* NOTES: Further information is in the OSVersion and OSBuild properties
'*****************************************************************************
OSBuild = typOSVersion.dwBuildNumber And &HFFFF&
End Property
Public Property Get CPULevel() As String
'*****************************************************************************
'* NAME: CPULEVEL
'* PURPOSE: To allow the CPULevel property to be inspected
'* ACCEPTS: Nothing
'* RETURNS: A string indicating the level of CPU installed
'* AUTHOR: Rob Smith
'* DATE: 22/06/97
'* NOTES: If the operating system is Win95, this value is found in the
' dwProcessorType element returned by GetSystemInfo. If WinNT,
' the value is in the wProcessorLevel element, and values returned
' are dependent on processor architecture
'*****************************************************************************
Select Case typOSVersion.dwPlatformId
Case VER_PLATFORM_WIN32_WINDOWS
Select Case typSysInfo.dwProcessorType
Case PROCESSOR_INTEL_386
CPULevel = "386"
Case PROCESSOR_INTEL_486
CPULevel = "486"
Case PROCESSOR_INTEL_PENTIUM
CPULevel = "Pentium"
End Select
Case VER_PLATFORM_WIN32_NT
Select Case typSysInfo.dwOemID
Case PROCESSOR_ARCHITECTURE_INTEL
Select Case typSysInfo.wProcessorLevel
Case 3
CPULevel = "386"
Case 4
CPULevel = "486"
Case 5
CPULevel = "Pentium"
End Select
Case PROCESSOR_ARCHITECTURE_MIPS
Select Case typSysInfo.wProcessorLevel
Case 4
CPULevel = "R4000"
End Select
Case PROCESSOR_ARCHITECTURE_ALPHA
Select Case typSysInfo.wProcessorLevel
Case 21064
CPULevel = "21064"
Case 21066
CPULevel = "21066"
Case 21164
CPULevel = "21164"
End Select
Case PROCESSOR_ARCHITECTURE_PPC
Select Case typSysInfo.wProcessorLevel
Case 1
CPULevel = "601"
Case 3
CPULevel = "603"
Case 4
CPULevel = "604"
Case 6
CPULevel = "603+"
Case 9
CPULevel = "604+"
Case 20
CPULevel = "620"
End Select
Case PROCESSOR_ARCHITECTURE_UNKNOWN
CPULevel = "Unknown"
End Select
End Select
End Property
Public Property Get ComputerName() As String
'*****************************************************************************
'* NAME: COMPUTERNAME
'* PURPOSE: To allow the ComputerName property to be inspected
'* ACCEPTS: Nothing
'* RETURNS: A string indicating the name of the computer
'* AUTHOR: Rob Smith
'* DATE: 22/06/97
'* NOTES:
'*****************************************************************************
ComputerName = strComputerName
End Property
Public Property Get UserName() As String
'*****************************************************************************
'* NAME: USERNAME
'* PURPOSE: To allow the UserName property to be inspected
'* ACCEPTS: Nothing
'* RETURNS: A string indicating the name of the currently logged-on user
'* AUTHOR: Rob Smith
'* DATE: 22/06/97
'* NOTES:
'*****************************************************************************
UserName = strUserName
End Property
Public Property Get WinStarted() As Date
'*****************************************************************************
'* NAME: WINSTARTED
'* PURPOSE: To allow the WinStarted property to be inspected
'* ACCEPTS: Nothing
'* RETURNS: A date indicating when Windows was last started
'* AUTHOR: Rob Smith
'* DATE: 22/06/97
'* NOTES: This value will not be accurate once the threshold of timeGetTime
' has been exceeded (around 47 days)
'*****************************************************************************
WinStarted = DateAdd("s", timeGetTime() / -1000, Now)
End Property
Public Property Get ScreenResolution() As String
'*****************************************************************************
'* NAME: SCREENRESOLUTION
'* PURPOSE: To allow the ScreenResolution property to be inspected
'* ACCEPTS: Nothing
'* RETURNS: A string indicating the current screen resolution (e.g. 640x480)
'* AUTHOR: Rob Smith
'* DATE: 22/06/97
'* NOTES:
'*****************************************************************************
Dim rct As RECT
Dim hwnd As Long
Dim lngReturn As Long
hwnd = GetDesktopWindow()
lngReturn = GetWindowRect(hwnd, rct)
ScreenResolution = (rct.x2 - rct.x1) & "x" & (rct.y2 - rct.y1)
End Property
Public Property Get ID() As Long
'*****************************************************************************
'* NAME: ID
'* PURPOSE: To return the unique ID of this class instance
'* ACCEPTS: Nothing
'* RETURNS: A long representing a unique(-ish?) ID
'* AUTHOR: David Sussman
'* DATE: 22/06/97
'* NOTES:
'*****************************************************************************
ID = lngID
End Property