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
|