VERSION 5.00 Begin VB.Form frmLotChLog Caption = "Changes Log" ClientHeight = 4305 ClientLeft = 60 ClientTop = 345 ClientWidth = 9885 KeyPreview = -1 'True LinkTopic = "Form1" ScaleHeight = 4305 ScaleWidth = 9885 StartUpPosition = 3 'Windows Default Begin VB.CommandButton cmdExit Caption = "&Exit" Height = 555 Left = 6840 TabIndex = 11 TabStop = 0 'False Top = 3660 Width = 1395 End Begin VB.ListBox lstChange Height = 4155 Left = 60 TabIndex = 0 Top = 60 Width = 5055 End Begin VB.Label lblOType BorderStyle = 1 'Fixed Single Height = 1635 Left = 6240 TabIndex = 13 Top = 1920 Width = 3555 WordWrap = -1 'True End Begin VB.Label lblODate BorderStyle = 1 'Fixed Single Height = 315 Left = 6240 TabIndex = 12 Top = 1560 Width = 2955 End Begin VB.Label lblOrderType Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Reason:" Height = 195 Left = 5550 TabIndex = 10 Top = 1980 Width = 600 End Begin VB.Label lblOrderDate Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Change Date:" Height = 195 Left = 5160 TabIndex = 9 Top = 1620 Width = 990 End Begin VB.Label lblSupplyName BorderStyle = 1 'Fixed Single Height = 315 Left = 6240 TabIndex = 8 Top = 1200 Width = 2955 End Begin VB.Label lblSupplier Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "User:" Height = 195 Left = 5775 TabIndex = 7 Top = 1275 Width = 375 End Begin VB.Label lblPONum BorderStyle = 1 'Fixed Single Height = 315 Left = 6240 TabIndex = 6 Top = 840 Width = 2955 End Begin VB.Label lblPO Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Action:" Height = 195 Left = 5655 TabIndex = 5 Top = 900 Width = 495 End Begin VB.Label lblProjDesc BorderStyle = 1 'Fixed Single Height = 315 Left = 6240 TabIndex = 4 Top = 480 Width = 3645 End Begin VB.Label lblLotNo Alignment = 1 'Right Justify BorderStyle = 1 'Fixed Single Height = 315 Left = 7275 TabIndex = 3 Top = 120 Width = 810 End Begin VB.Label lblProjCode BorderStyle = 1 'Fixed Single Height = 315 Left = 6240 TabIndex = 2 Top = 120 Width = 1005 End Begin VB.Label lblName Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Lot:" Height = 195 Left = 5880 TabIndex = 1 Top = 180 Width = 270 End End Attribute VB_Name = "frmLotChLog" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Dim moRSCHANGE As Recordset Dim mboolAdding As Boolean Private Sub cmdExit_Click() Unload Me End Sub Private Sub Form_Activate() Dim intResponse As Integer Dim strSQL As String On Error GoTo Error_EH Exit Sub Error_EH: gstrMODULE = "FormLotChangeLog - Module Form_Activate" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) Dim ShiftDown, AltDown, CtrlDown If Shift = 4 Then Exit Sub End If ShiftDown = (Shift And vbShiftMask) > 0 AltDown = (Shift And vbAltMask) > 0 CtrlDown = (Shift And vbCtrlMask) > 0 End Sub Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" KeyAscii = 0 End If End Sub Private Sub Form_Load() On Error GoTo Error_EH Call CrewLoad If lstChange.ListIndex <> -1 Then If FormFindCrew() Then Call FormShowCrew End If End If ' Call cmdTotal_Click Exit Sub Error_EH: gstrMODULE = "FormLotChangeLog - Module Form_Load" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub CrewLoad() Dim oRS As Recordset Dim strSQL As String Dim strLine As String On Error GoTo Error_EH strSQL = "SELECT action, chgdate, change_id FROM tblLotChange WHERE lot_id = " & gintLOTID & " ORDER BY chgdate" Set oRS = New Recordset oRS.Open strSQL, goConn, adOpenForwardOnly, adLockReadOnly lstChange.Clear Do Until oRS.EOF With lstChange strLine = Field2Str(oRS!Chgdate) & vbTab & Field2Str(oRS!Action) .AddItem strLine .ItemData(.NewIndex) = oRS!change_id End With oRS.MoveNext Loop If lstChange.ListCount Then lstChange.ListIndex = 0 Else lstChange.ListIndex = -1 Call FormClear End If Exit Sub Error_EH: gstrMODULE = "FormLotChangeLog - Module CrewLoad" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Function FormFindCrew() As Boolean Dim strSQL As String On Error GoTo Error_EH strSQL = "SELECT * " strSQL = strSQL & "FROM tblLotChange " strSQL = strSQL & "WHERE Change_Id = " & lstChange.ItemData(lstChange.ListIndex) Set moRSCHANGE = New Recordset moRSCHANGE.Open strSQL, goConn, _ adOpenKeyset, adLockPessimistic If moRSCHANGE.EOF Then FormFindCrew = False Else FormFindCrew = True End If Exit Function Error_EH: gstrMODULE = "FormLotChangeLog - Module FormFindCrew" Call ErrorHandler2 gstrMODULE = "" Exit Function End Function Private Sub FormShowCrew() Dim strSQL As String, strSql2 As String Dim oRS As Recordset, oRSS As Recordset On Error GoTo Error_EH With moRSCHANGE lblODate.Caption = Field2Str(!Chgdate) lblSupplyName = Field2Str(!User) lblPONum.Caption = Field2Str(!Action) lblOType.Caption = Field2Str(!reason) strSQL = "SELECT proj_id,Lot_no FROM tblLotInfo WHERE lot_id = " & Field2Str(!Lot_id) Set oRS = New Recordset oRS.Open strSQL, goConn, adOpenForwardOnly, adLockReadOnly If Not oRS.EOF Then strSql2 = "SELECT proj_code, proj_desc FROM tblProject WHERE proj_id = " & Field2Str(oRS!proj_id) Set oRSS = New Recordset oRSS.Open strSql2, goConn, adOpenForwardOnly, adLockReadOnly If Not oRSS.EOF Then lblLotNo.Caption = Field2Str(oRS!lot_no) lblProjCode.Caption = Field2Str(oRSS!proj_code) lblProjDesc.Caption = Field2Str(oRSS!proj_desc) End If End If End With Exit Sub Error_EH: gstrMODULE = "FormLotChangeLog - Module FormShowCrew" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub FormClear() lblLotNo.Caption = "" lblProjDesc.Caption = "" lblProjCode.Caption = "" lblOType.Caption = "" lblODate.Caption = "" lblPONum.Caption = "" lblSupplyName.Caption = "" End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Dim intResponse As Integer, strMSG As String On Error GoTo Error_EH ' If cmdSave.Enabled Then ' strMSG = "Crew Data Has Been Changed" ' strMSG = strMSG & Chr(13) & Chr(10) ' strMSG = strMSG & "Save Changes ?" ' intResponse = MsgBox(strMSG, vbQuestion + vbYesNoCancel, Me.Caption) ' Select Case intResponse ' Case vbYes ' Call FormSave ' Case vbNo ' Case vbCancel ' Cancel = True ' Exit Sub ' End Select ' End If If moRSCHANGE.State = adStateOpen Then moRSCHANGE.Close End If Exit Sub Error_EH: If Err = 3219 Then Resume Next End If End Sub Private Sub lstChange_Click() On Error GoTo Error_EH If lstChange.ListIndex <> -1 Then If FormFindCrew() Then Call FormShowCrew Else lstChange.Clear Call FormClear End If End If Exit Sub Error_EH: gstrMODULE = "Form Crews - Module lstChange_Click" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub