VB5, VB6 Use the Orders Form
Option Explicit

Private mstrAccount As String
Private mstrDomain As String
Private Declare Function GetUserName Lib _
   "advapi32.dll" Alias "GetUserNameA" _
   (ByVal lpBuffer As String, nSize As Long) As Long

'********************************************
Private Sub cmdOrders_Click()

Dim clsOrders As New NWIND.Orders

'set the domain and user account
clsOrders.UserDomain = mstrDomain
clsOrders.UserAccount = mstrAccount

'populate the data control and the grid
Set adoOrders.Recordset = clsOrders.ListOrders

Set clsOrders = Nothing

End Sub

'********************************************
Private Sub Form_Load()

'find the domain and user account
mstrAccount = Space(255)
mstrDomain = "WORKGROUP/SSOSA"

GetUserName mstrAccount, Len(mstrAccount)
mstrAccount = Trim(mstrAccount)

lblUser.Caption = "The user account is " & _
   mstrDomain & "/" & mstrAccount

End Sub
Listing 4 This code from the solution’s user services tier determines the currently logged-in user using the Win32 API and calls the Orders component in the ActiveX DLL.