VERSION 5.00 Begin VB.Form frmPOList Caption = "Purchase Order List" 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 lstCrew Height = 4155 Left = 60 Sorted = -1 'True TabIndex = 0 Top = 60 Width = 5055 End Begin VB.Label lblOType BorderStyle = 1 'Fixed Single Height = 315 Left = 6120 TabIndex = 13 Top = 1920 Width = 2955 End Begin VB.Label lblODate BorderStyle = 1 'Fixed Single Height = 315 Left = 6120 TabIndex = 12 Top = 1560 Width = 2955 End Begin VB.Label lblOrderType Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Order Type" Height = 195 Left = 5235 TabIndex = 10 Top = 1980 Width = 795 End Begin VB.Label lblOrderDate Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Order Date:" Height = 195 Left = 5205 TabIndex = 9 Top = 1620 Width = 825 End Begin VB.Label lblSupplyName BorderStyle = 1 'Fixed Single Height = 315 Left = 6120 TabIndex = 8 Top = 1200 Width = 2955 End Begin VB.Label lblSupplier Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Supplier:" Height = 195 Left = 5415 TabIndex = 7 Top = 1275 Width = 615 End Begin VB.Label lblPONum BorderStyle = 1 'Fixed Single Height = 315 Left = 6120 TabIndex = 6 Top = 840 Width = 2955 End Begin VB.Label lblPO Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "PO Num:" Height = 195 Left = 5385 TabIndex = 5 Top = 900 Width = 645 End Begin VB.Label lblProjDesc BorderStyle = 1 'Fixed Single Height = 315 Left = 6120 TabIndex = 4 Top = 480 Width = 3645 End Begin VB.Label lblLotNo Alignment = 1 'Right Justify BorderStyle = 1 'Fixed Single Height = 315 Left = 7140 TabIndex = 3 Top = 120 Width = 810 End Begin VB.Label lblProjCode BorderStyle = 1 'Fixed Single Height = 315 Left = 6120 TabIndex = 2 Top = 120 Width = 1005 End Begin VB.Label lblName Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Lot:" Height = 195 Left = 5760 TabIndex = 1 Top = 180 Width = 270 End End Attribute VB_Name = "frmPOList" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Dim moRSORDER 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 = "FormPOList - 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 lstCrew.ListIndex <> -1 Then If FormFindCrew() Then Call FormShowCrew End If End If ' Call cmdTotal_Click Exit Sub Error_EH: gstrMODULE = "FormPOList - 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 PO_Num, Order_Date, Supplier, Order_id from tblOrders" Set oRS = New Recordset oRS.Open strSQL, goConn, adOpenForwardOnly, adLockReadOnly lstCrew.Clear Do Until oRS.EOF With lstCrew strLine = Field2Str(oRS!po_Num) & vbTab & Field2Str(oRS!order_date) & vbTab & Field2Str(oRS!supplier) .AddItem strLine .ItemData(.NewIndex) = oRS!order_id End With oRS.MoveNext Loop If lstCrew.ListCount Then lstCrew.ListIndex = 0 Else lstCrew.ListIndex = -1 Call FormClear End If Exit Sub Error_EH: gstrMODULE = "FormPOList - 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 tblorders " strSQL = strSQL & "WHERE order_Id = " & lstCrew.ItemData(lstCrew.ListIndex) Set moRSORDER = New Recordset moRSORDER.Open strSQL, goConn, _ adOpenKeyset, adLockPessimistic If moRSORDER.EOF Then FormFindCrew = False Else FormFindCrew = True End If Exit Function Error_EH: gstrMODULE = "FormPOList - 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 moRSORDER If Field2Str(!m_type) = "L" Then lblOType.Caption = "LATH" ElseIf Field2Str(!m_type) = "T" Then lblOType.Caption = "TEXTURE" ElseIf Field2Str(!m_type) = "B" Then lblOType.Caption = "BROWN" ElseIf Field2Str(!m_type) = "S" Then lblOType.Caption = "SCRATCH" ElseIf Field2Str(!m_type) = "A" Then lblOType.Caption = "SAND" ElseIf Field2Str(!m_type) = "P" Then lblOType.Caption = "PREORDER" ElseIf Field2Str(!m_type) = "R" Then lblOType.Caption = "PURCHASE ORDER" End If lblODate.Caption = Field2Str(!order_date) lblSupplyName = Field2Str(!supplier) lblPONum.Caption = Field2Str(!po_Num) 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 = "FormPOList - 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 moRSORDER.State = adStateOpen Then moRSORDER.Close End If Exit Sub Error_EH: If Err = 3219 Then Resume Next End If End Sub Private Sub lstCrew_Click() On Error GoTo Error_EH If lstCrew.ListIndex <> -1 Then If FormFindCrew() Then Call FormShowCrew Else lstCrew.Clear Call FormClear End If End If Exit Sub Error_EH: gstrMODULE = "Form Crews - Module lstCrew_Click" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub