VERSION 5.00 Begin VB.Form frmElevPic Caption = "Picture File Name" ClientHeight = 3450 ClientLeft = 60 ClientTop = 345 ClientWidth = 5910 KeyPreview = -1 'True LinkTopic = "Form1" ScaleHeight = 3450 ScaleWidth = 5910 StartUpPosition = 3 'Windows Default Begin VB.CheckBox chkPrimary Caption = "Front Elevation" Height = 315 Left = 3360 TabIndex = 1 Top = 360 Width = 1935 End Begin VB.CommandButton cmdExit Caption = "Exit" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 525 Left = 4740 TabIndex = 11 TabStop = 0 'False Top = 2880 Width = 1035 End Begin VB.CommandButton cmdDelete Caption = "&Delete File" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 525 Left = 3360 TabIndex = 10 TabStop = 0 'False Top = 2880 Width = 1035 End Begin VB.CommandButton cmdSave Caption = "&Save File" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 525 Left = 4740 TabIndex = 4 Top = 2280 Width = 1035 End Begin VB.CommandButton cmdAdd Caption = "&Add File" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 525 Left = 3360 TabIndex = 9 TabStop = 0 'False Top = 2280 Width = 1035 End Begin VB.TextBox txtFileName Height = 375 Left = 3360 TabIndex = 3 Top = 1800 Width = 2415 End Begin VB.TextBox txtFolder Height = 375 Left = 3360 TabIndex = 2 Top = 1080 Width = 2415 End Begin VB.ListBox lstFile Height = 2595 Left = 120 TabIndex = 0 Top = 780 Width = 2955 End Begin VB.Label lblFile Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "File Name:" Height = 195 Left = 3420 TabIndex = 8 Top = 1560 Width = 750 End Begin VB.Label lblFolder Alignment = 1 'Right Justify AutoSize = -1 'True Caption = "Folder Name:" Height = 195 Left = 3420 TabIndex = 7 Top = 840 Width = 945 End Begin VB.Label lblPic AutoSize = -1 'True Caption = "File Name List" Height = 195 Left = 120 TabIndex = 6 Top = 480 Width = 990 End Begin VB.Label lblModElev BorderStyle = 1 'Fixed Single Height = 315 Left = 120 TabIndex = 5 Top = 60 Width = 1755 End End Attribute VB_Name = "frmElevPic" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Dim moRSFILE As Recordset Dim mboolSHOW As Boolean Dim mboolAdding As Boolean Dim mboolCopy As Boolean, mintBOOKMARK As Integer Dim mstrType As String, mstrMODEL As String Dim mintESTID As Integer, mintFILEID As Integer Dim mintOPTID As Integer, mintLOTID As Integer Dim mstrSQL As String Private Sub cmdExit_Click() Unload Me End Sub Private Sub cmdSave_Click() mintBOOKMARK = lstFile.ListIndex cmdExit.Enabled = True cmdAdd.Enabled = True cmdSave.Enabled = False Call FormSave lstFile.Enabled = True lstFile.ListIndex = mintBOOKMARK mintBOOKMARK = 0 End Sub Private Sub cmdAdd_Click() cmdAdd.Enabled = False cmdSave.Enabled = True cmdDelete.Enabled = False mboolAdding = True Call FormClear txtFolder.SetFocus End Sub Private Sub cmdDelete_Click() cmdSave.Enabled = False cmdDelete.Enabled = False cmdAdd.Enabled = True moRSFILE.Delete Call FileLoad End Sub Private Sub FileLoad() Dim oRS As Recordset Dim strSQL As String Dim strLine As String Dim lngRET As Long, aTabs(2) As Long aTabs(0) = 10 aTabs(1) = 200 ' aTabs(2) = 40 ' aTabs(3) = 90 ' aTabs(4) = 110 strSQL = "SELECT * from tblElevation WHERE Est_ID = " & gintESTID Set oRS = New Recordset oRS.Open strSQL, goConn, adOpenForwardOnly, adLockReadOnly lngRET = SendMessage(lstFile.hwnd, LB_SETTABSTOPS, 2, 50) lstFile.Clear lstFile.Visible = True Do Until oRS.EOF With lstFile ' mintCREW = Field2Integer(oRS!crew_id) strLine = oRS!folder & vbTab & oRS!FileName ' strLine = strLine & vbTab & oRS!paydt ' strLine = strLine & vbTab & oRS!crew & vbTab & mstrCREW .AddItem strLine .ItemData(.NewIndex) = oRS!file_id End With oRS.MoveNext Loop oRS.Close If lstFile.ListCount Then lstFile.ListIndex = 0 End If End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If Shift = 4 Then Exit Sub End If 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() Dim strSQL As String Dim oRS As Recordset On Error GoTo Error_EH Set moRSFILE = New Recordset Call FileLoad ' If FormFind() Then ' Call ProjectSelect ' Call LotSelect ' Call FormShow ' Else ' Call FormClear ' End If Exit Sub Error_EH: gstrMODULE = "Form ElevPic - Module Form_Load" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Function FormFind() As Boolean Dim strSQL As String, strPlan As String, strMEMO As String On Error GoTo Error_EH strSQL = "SELECT * " strSQL = strSQL & "FROM tblElevation " strSQL = strSQL & "WHERE file_ID = " & mintFILEID 'lstFile.ItemData(lstFile.ListIndex) Set moRSFILE = New Recordset moRSFILE.Open strSQL, goConn, adOpenKeyset, adLockOptimistic If moRSFILE.EOF Then FormFind = False Else FormFind = True ' gintLOTID = Field2Str2(moRSFILE!Lot_id) End If Exit Function Error_EH: gstrMODULE = "Form ElevPic - Module FormFind" Call ErrorHandler2 gstrMODULE = "" Exit Function End Function Private Sub FormShow() Dim strSQL As String Dim oRS As Recordset On Error GoTo Error_EH mboolSHOW = True strSQL = "Select * FROM tblPlans WHERE Est_id = " & gintESTID Set oRS = New Recordset oRS.Open strSQL, goConn, adOpenKeyset, adLockOptimistic lblModElev.Caption = Trim(Field2Str(oRS!mod_elv)) With moRSFILE txtFolder = Field2Str(!folder) txtFileName = Field2Str(!FileName) chkPrimary = Field2CheckBox(!Primary) End With mboolSHOW = False Exit Sub Error_EH: gstrMODULE = "Form ElevPic - Module FormShow" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub FieldsSave() Dim strFile As String, strField As String Dim strLOT As String On Error GoTo Error_EH With moRSFILE !folder = Str2Field(txtFolder) !FileName = Str2Field(txtFileName) !Primary = chkPrimary End With moRSFILE.Update If mboolAdding Then 'strfile ='' mintFILEID = FindMax("tblElevation", "file_id") End If If FormFind() Then Call FormShow 'xxxxxxxxxxxxxxxxxx Else Call FormClear End If Exit Sub Error_EH: If Err.Number = -2147467259 Then ' MsgBox "Duplicate Lot Record - This will not be saved - ReEnter", , "Duplicate Record" ' strLOT = InputBox("Enter a New Lot Number", "Fix Duplicate") ' If Len(strLOT) > 0 Then ' moRS!lot_no = Field2Str(strLOT) ' moRS.Update ' txtLotNo = Field2Str(strLOT) ' End If Resume Next End If gstrMODULE = "Form ElevPic - Module FieldsSave" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub FormClear() txtFolder = "" txtFileName = "" chkPrimary = vbUnchecked End Sub Private Sub FormSave() Dim strName As String On Error GoTo Error_EH If mboolAdding Then moRSFILE.AddNew moRSFILE!est_id = gintESTID End If ' Store the controls to the recordset Call FieldsSave moRSFILE.Update Call FileLoad Exit Sub Error_EH: gstrMODULE = "Form ElevPic - Module FormSave" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If moRSFILE.State = adStateOpen Then moRSFILE.Close End If End Sub Private Sub lstFile_Click() On Error GoTo Error_EH If lstFile.ListIndex <> -1 Then mintFILEID = lstFile.ItemData(lstFile.ListIndex) If FormFind() Then Call FormShow Else Call FormClear End If End If Exit Sub Error_EH: gstrMODULE = "Form ElevPic - Module lstFile_Click" Call ErrorHandler2 gstrMODULE = "" Exit Sub End Sub Private Sub lstFile_DblClick() cmdSave.Enabled = True End Sub Private Sub Form_Activate() Dim intResponse As Integer Dim strSQL As String If lstFile.ListCount = 0 Then intResponse = MsgBox("No Plan/Elevation, do you wish to add one?", vbYesNo + vbQuestion, "Add Records") If intResponse = vbYes Then strSQL = "SELECT * FROM tblElevation WHERE est_id = 1" Set moRSFILE = New Recordset moRSFILE.Open strSQL, goConn, adOpenKeyset, adLockOptimistic Call cmdAdd_Click Else Unload Me End If End If End Sub Private Sub txtFileName_GotFocus() Call FieldSelect(txtFileName) End Sub Private Sub txtFileName_LostFocus() txtFileName = UCase(txtFileName) End Sub Private Sub txtFolder_GotFocus() Call FieldSelect(txtFolder) End Sub Private Sub txtFolder_LostFocus() txtFolder = UCase(txtFolder) End Sub