VERSION 5.00 Begin VB.Form frmUser Caption = "User Information" ClientHeight = 5250 ClientLeft = 60 ClientTop = 405 ClientWidth = 5205 KeyPreview = -1 'True LinkTopic = "Form1" ScaleHeight = 5250 ScaleWidth = 5205 StartUpPosition = 3 'Windows Default Begin VB.CheckBox chkINVADD Alignment = 1 'Right Justify Caption = "Add ORDERS INV Items" Height = 225 Left = 2955 TabIndex = 21 Top = 4350 Width = 2115 End Begin VB.CheckBox chkLocked Alignment = 1 'Right Justify Caption = "Locked Out:" Height = 225 Left = 3855 TabIndex = 20 Top = 4095 Width = 1215 End Begin VB.CommandButton cmdExit Caption = "E&xit" Height = 555 Left = 3780 TabIndex = 19 Top = 4620 Width = 1335 End Begin VB.CommandButton cmdSave Caption = "&Save" Enabled = 0 'False Height = 555 Left = 1890 TabIndex = 18 Top = 4620 Width = 1215 End Begin VB.CommandButton cmdAdd Caption = "&Add" Height = 555 Left = 60 TabIndex = 17 Top = 4620 Width = 1155 End Begin VB.ComboBox cboSecurity Height = 315 ItemData = "frmUser.frx":0000 Left = 3000 List = "frmUser.frx":0002 Style = 2 'Dropdown List TabIndex = 16 Top = 2250 Width = 2115 End Begin VB.TextBox txtLastLogin Enabled = 0 'False Height = 315 Left = 3000 TabIndex = 15 Top = 3660 Width = 1695 End Begin VB.TextBox txtLastUpdate Enabled = 0 'False Height = 315 Left = 3000 TabIndex = 14 Top = 3186 Width = 1695 End Begin VB.TextBox txtLastUpUser Enabled = 0 'False Height = 315 Left = 3000 TabIndex = 13 Top = 2715 Width = 1095 End Begin VB.TextBox txtPassword Height = 315 IMEMode = 3 'DISABLE Left = 3000 MaxLength = 15 TabIndex = 12 Top = 1773 Width = 1695 End Begin VB.TextBox txtUserId Height = 315 Left = 3000 MaxLength = 6 TabIndex = 11 Top = 1302 Width = 1095 End Begin VB.TextBox txtFirst Height = 315 Left = 3000 MaxLength = 20 TabIndex = 10 Top = 831 Width = 2115 End Begin VB.TextBox txtLast Height = 315 Left = 3000 MaxLength = 20 TabIndex = 9 Top = 360 Width = 2115 End Begin VB.ListBox lstUser Height = 3570 Left = 60 TabIndex = 0 Top = 420 Width = 1215 End Begin VB.Label lblLastLogDate Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Last Login Date:" Height = 195 Left = 1725 TabIndex = 8 Top = 3720 Width = 1170 End Begin VB.Label lblLastUDate Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Last Updated Date:" Height = 195 Left = 1500 TabIndex = 7 Top = 3246 Width = 1395 End Begin VB.Label lblLastUpUser Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Last Updated By:" Height = 195 Left = 1665 TabIndex = 6 Top = 2775 Width = 1230 End Begin VB.Label lblSecurity Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Sercurity Level:" Height = 195 Left = 1800 TabIndex = 5 Top = 2304 Width = 1095 End Begin VB.Label lblPassword Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Password:" Height = 195 Left = 2160 TabIndex = 4 Top = 1833 Width = 735 End Begin VB.Label lblUserId Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "User Id:" Height = 195 Left = 2340 TabIndex = 3 Top = 1362 Width = 555 End Begin VB.Label lblFirst Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "First Name:" Height = 195 Left = 2100 TabIndex = 2 Top = 891 Width = 795 End Begin VB.Label lblLast Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Last Name:" Height = 195 Left = 2085 TabIndex = 1 Top = 420 Width = 810 End End Attribute VB_Name = "frmUser" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Dim moRSUser As Recordset Dim mboolSHOW As Boolean Dim mboolAdding As Boolean Dim mboolDelete As Boolean Private Sub cmdAdd_Click() cmdAdd.Enabled = False ' cmdDelete.Enabled = False cmdExit.Enabled = False lstUser.Enabled = False mboolAdding = True Call FormClear End Sub Private Sub cmdExit_Click() Unload Me End Sub Private Sub cmdSave_Click() lstUser.Enabled = True ' cmdDelete.Enabled = True cmdSave.Enabled = False cmdAdd.Enabled = True cmdExit.Enabled = True Call FormSave End Sub Private Sub Form_Load() Call UserLoad Call SecurityLoad End Sub Private Sub UserLoad() Dim oRS As Recordset Dim strSQL As String Dim strLine As String strSQL = "SELECT Userid, LoginId from tblUsers" Set oRS = New Recordset oRS.Open strSQL, goConn, adOpenForwardOnly, adLockReadOnly lstUser.Clear Do Until oRS.EOF With lstUser .AddItem Field2Str(oRS!loginid) .ItemData(.NewIndex) = oRS!userid End With oRS.MoveNext Loop oRS.Close If lstUser.ListCount Then lstUser.ListIndex = -1 End If End Sub Private Sub FormSave() Dim intBOOKMARK As Integer On Error GoTo Error_EH If mboolAdding Then moRSUser.AddNew Else intBOOKMARK = lstUser.ListIndex End If Call FieldsSave moRSUser.Update If mboolAdding Then mboolAdding = False intBOOKMARK = 0 End If Call UserLoad lstUser.ListIndex = intBOOKMARK Exit Sub Error_EH: Call ErrorHandler(moRSUser.ActiveConnection) Exit Sub End Sub Private Sub SecurityLoad() cboSecurity.Clear cboSecurity.AddItem ("Administrative") cboSecurity.ItemData(cboSecurity.NewIndex) = 1 cboSecurity.AddItem ("Estimating") cboSecurity.ItemData(cboSecurity.NewIndex) = 2 cboSecurity.AddItem ("Orders") cboSecurity.ItemData(cboSecurity.NewIndex) = 6 cboSecurity.AddItem ("Billing") cboSecurity.ItemData(cboSecurity.NewIndex) = 7 cboSecurity.AddItem ("Payroll View") cboSecurity.ItemData(cboSecurity.NewIndex) = 8 cboSecurity.AddItem ("Inventory") cboSecurity.ItemData(cboSecurity.NewIndex) = 9 cboSecurity.AddItem ("Payroll Process") cboSecurity.ItemData(cboSecurity.NewIndex) = 10 End Sub Private Sub FormClear() txtLast = "" txtFirst = "" txtUserId = "" txtPassword = "" txtLastLogin = "" txtLastUpdate = "" txtLastUpUser = "" chkLocked = vbUnchecked cboSecurity.ListIndex = -1 End Sub Private Function FormFind() As Boolean Dim strSQL As String, strPlan As String strSQL = "SELECT * " strSQL = strSQL & "FROM tblUsers " strSQL = strSQL & "WHERE userid = " & lstUser.ItemData(lstUser.ListIndex) Set moRSUser = New Recordset moRSUser.Open strSQL, goConn, _ adOpenKeyset, adLockPessimistic If moRSUser.EOF Then FormFind = False Else FormFind = True End If End Function Private Sub FieldsSave() With moRSUser !LastName = Str2Field(txtLast) !FirstName = Str2Field(txtFirst) !loginid = Str2Field(txtUserId) !Password = Str2Field(txtPassword) !security = cboSecurity.ItemData(cboSecurity.ListIndex) !lastupdateid = gstrLOGIN !lastupdatedate = Now() !lastlogin = Str2Field(txtLastLogin) !Locked = chkLocked !INVAdd = chkINVADD End With moRSUser.Update End Sub Private Sub lstUser_Click() If lstUser.ListIndex <> -1 Then If FormFind() Then Call FormShow End If End If End Sub Private Sub FormShow() mboolSHOW = True With moRSUser txtLast = Field2Str(!LastName) txtFirst = Field2Str(!FirstName) txtUserId = Field2Str(!loginid) txtPassword = Field2Str(!Password) txtLastUpUser = Field2Str(!lastupdateid) txtLastUpdate = Field2Str(!lastupdatedate) txtLastLogin = Field2Str(!lastlogin) chkLocked = Field2CheckBox(!Locked) chkINVADD = Field2CheckBox(!INVAdd) Select Case Field2Integer(!security) Case 1 cboSecurity = "Administrative" Case 2 cboSecurity = "Estimating" Case 6 cboSecurity = "Orders" Case 7 cboSecurity = "Billing" Case 8 cboSecurity = "Payroll View" Case 9 cboSecurity = "Inventory" Case 10 cboSecurity = "Payroll Process" End Select End With mboolSHOW = False End Sub Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" KeyAscii = 0 End If End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If Shift = 4 Then Exit Sub End If If Not cmdSave.Enabled Then cmdSave.Enabled = True cmdAdd.Enabled = False End If End Sub Private Sub lstUser_DblClick() If Not cmdSave.Enabled Then cmdSave.Enabled = True cmdAdd.Enabled = False End If End Sub Private Sub txtFirst_GotFocus() Call FieldSelect(txtFirst) End Sub Private Sub txtLast_GotFocus() Call FieldSelect(txtLast) End Sub Private Sub txtPassword_GotFocus() Call FieldSelect(txtPassword) End Sub Private Sub txtUserId_GotFocus() Call FieldSelect(txtUserId) End Sub