Private Sub cmbsubmit_Click()
Dim iRow As Long
Dim x As Integer
Dim ws As Worksheet
Set ws = Worksheets("DynoRepairData")
'check for data in the cells
If Trim(Me.txtjo.Value) = "" Then
Me.txtjo.SetFocus
MsgBox "Please enter a Job Number"
Exit Sub
ElseIf Trim(Me.txtdte.Value) = "" Then
Me.txtdte.SetFocus
MsgBox "Please enter a Date"
Exit Sub
ElseIf Trim(Me.cmbbxmodel.Value) = "" Then
Me.cmbbxmodel.SetFocus
MsgBox "Please enter the model number"
Exit Sub
ElseIf Trim(Me.txtsrl.Value) = "" Then
Me.txtsrl.SetFocus
MsgBox "Please enter the engine serial number"
Exit Sub
ElseIf Trim(Me.txttchn.Value) = "" Then
Me.txttchn.SetFocus
MsgBox "Please enter your name"
Exit Sub
ElseIf Trim(Me.txthtvlt.Value) = "" Then
Me.txthtvlt.SetFocus
MsgBox "Please enter the heater voltage"
Exit Sub
ElseIf Trim(Me.txtwt.Value) = "" Then
Me.txtwt.SetFocus
MsgBox "Please enter the wattage"
Exit Sub
ElseIf Trim(Me.txtdynotechinitials.Value) = "" Then
Me.txtdynotechinitials.SetFocus
MsgBox "Dont forget to initial"
Exit Sub
End If
'find first empty row in database
Start: iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
'copy the data to the database use protect and unprotect lines,
' with your password if worksheet is protected
With ws
' .Unprotect Password:="password"
.Cells(iRow, 1).Value = Me.txtjo.Value
.Cells(iRow, 2).Value = Me.txtdte.Value
.Cells(iRow, 3).Value = Me.cmbbxmodel.Value
.Cells(iRow, 4).Value = Me.txtsrl.Value
.Cells(iRow, 5).Value = Me.txttchn.Value
.Cells(iRow, 6).Value = Me.txthtvlt.Value
.Cells(iRow, 7).Value = Me.txtwt.Value
.Cells(iRow, 12).Value = Me.txtRprcmnt.Value
If OptionButtondynoyes = True Then .Cells(iRow, 13).Value = "Yes"
If OptionButtondynono = True Then
.Cells(iRow, 13).Value = "No"
DynoFailureReport.PrintForm
OptionButtondynono = False
End If
.Cells(iRow, 14).Value = Me.txtdynotechinitials.Value
' is chosen in the failed system box
If Me.cmbxfs1.Value = "" Then
Else
.Cells(iRow, 8).Value = Me.cmbxfs1.Value
.Cells(iRow, 9).Value = Me.cmbxfd1.Value
.Cells(iRow, 10).Value = Me.txtft1.Value
Me.cmbxfs1.Value = ""
Me.cmbxfd1.Value = ""
Me.txtft1.Value = ""
GoTo Start
End If
If Me.cmbxfs2.Value = "" Then
Else
.Cells(iRow, 8).Value = Me.cmbxfs2.Value
.Cells(iRow, 9).Value = Me.cmbxfd2.Value
.Cells(iRow, 10).Value = Me.txtft2.Value
Me.cmbxfs2.Value = ""
Me.cmbxfd2.Value = ""
Me.txtft2.Value = ""
GoTo Start
End If
If Me.cmbxfs3.Value = "" Then
Else
.Cells(iRow, 8).Value = Me.cmbxfs3.Value
.Cells(iRow, 9).Value = Me.cmbxfd3.Value
.Cells(iRow, 10).Value = Me.txtft3.Value
Me.cmbxfs3.Value = ""
Me.cmbxfd3.Value = ""
Me.txtft3.Value = ""
GoTo Start
End If
If Me.cmbxfs4.Value = "" Then
Else
.Cells(iRow, 8).Value = Me.cmbxfs4.Value
.Cells(iRow, 9).Value = Me.cmbxfd4.Value
.Cells(iRow, 10).Value = Me.txtft4.Value
Me.cmbxfs4.Value = ""
Me.cmbxfd4.Value = ""
Me.txtft4.Value = ""
GoTo Start
End If
If Me.cmbxfs5.Value = "" Then
Else
.Cells(iRow, 8).Value = Me.cmbxfs5.Value
.Cells(iRow, 9).Value = Me.cmbxfd5.Value
.Cells(iRow, 10).Value = Me.txtft5.Value
Me.cmbxfs5.Value = ""
Me.cmbxfd5.Value = ""
Me.txtft5.Value = ""
GoTo Start
End If
If Me.cmbxfs6.Value = "" Then
Else
.Cells(iRow, 8).Value = Me.cmbxfs6.Value
.Cells(iRow, 9).Value = Me.cmbxfd6.Value
.Cells(iRow, 10).Value = Me.txtft6.Value
Me.cmbxfs6.Value = ""
Me.cmbxfd6.Value = ""
Me.txtft6.Value = ""
GoTo Start
End If
.Cells(iRow, 1).Value = ""
.Cells(iRow, 2).Value = ""
.Cells(iRow, 3).Value = ""
.Cells(iRow, 4).Value = ""
.Cells(iRow, 5).Value = ""
.Cells(iRow, 6).Value = ""
.Cells(iRow, 7).Value = ""
.Cells(iRow, 8).Value = ""
.Cells(iRow, 11).Value = ""
.Cells(iRow, 12).Value = ""
.Cells(iRow, 13).Value = ""
.Cells(iRow, 14).Value = ""
' .Protect Password:="password"
End With
Me.txtjo.Value = ""
Me.cmbbxmodel.Value = ""
Me.txtsrl.Value = ""
Me.txttchn.Value = ""
Me.txthtvlt.Value = ""
Me.txtwt.Value = ""
Me.txtRprcmnt.Value = ""
Me.OptionButtondynoyes.Value = False
Me.OptionButtondynono.Value = False
Me.txtdynotechinitials.Value = ""
Me.txtjo.SetFocus
ActiveWorkbook.Save
End Sub
Private Sub Form_Load()
ComboBoxMECAByesno.AddItem [,Yes]
ComboBoxMECAByesno.AddItem [,No]
End Sub
Private Sub cmbxfd1_Change()
Dim str As String
str = cmbxfd1.Text & " for" & cmbxfs1.Text
End Sub
Private Sub cmbxfs1_Click()
Dim x As Integer
x = cmbxfs1.ListIndex
Select Case x
Case Is = 0
cmbxfd1.RowSource = "Assembly_Operator"
Case Is = 1
cmbxfd1.RowSource = "Base_Engine"
Case Is = 2
cmbxfd1.RowSource = "Belts_And_Pulleys"
Case Is = 3
cmbxfd1.RowSource = "CAC"
Case Is = 4
cmbxfd1.RowSource = "Control_Panel"
Case Is = 5
cmbxfd1.RowSource = "Coolant_System"
Case Is = 6
cmbxfd1.RowSource = "Cooling_Loop"
Case Is = 7
cmbxfd1.RowSource = "Electrical"
Case Is = 8
cmbxfd1.RowSource = "Engine_Oil"
Case Is = 9
cmbxfd1.RowSource = "Fuel_System"
Case Is = 10
cmbxfd1.RowSource = "Governor_Spring"
Case Is = 11
cmbxfd1.RowSource = "Guards_And_Brackets"
Case Is = 12
cmbxfd1.RowSource = "Heat_Exchanger"
Case Is = 13
cmbxfd1.RowSource = "Heater"
Case Is = 14
cmbxfd1.RowSource = "Injection_Pump"
Case Is = 15
cmbxfd1.RowSource = "Mag_Pick -Up"
Case Is = 16
cmbxfd1.RowSource = "Piping_Kit"
Case Is = 17
cmbxfd1.RowSource = "Part_Failure"
Case Is = 18
cmbxfd1.RowSource = "Sensor"
Case Is = 19
cmbxfd1.RowSource = "Test_Cell"
Case Is = 20
cmbxfd1.RowSource = "Turbo"
Case Is = 21
cmbxfd1.RowSource = "Wiring_Harness"
End Select
End Sub
Private Sub cmbxfs2_Change()
Dim x As Integer
x = cmbxfs2.ListIndex
Select Case x
Case Is = 0
cmbxfd2.RowSource = "Assembly_Operator"
Case Is = 1
cmbxfd2.RowSource = "Base_Engine"
Case Is = 2
cmbxfd2.RowSource = "Belts_And_Pulleys"
Case Is = 3
cmbxfd2.RowSource = "CAC"
Case Is = 4
cmbxfd2.RowSource = "Control_Panel"
Case Is = 5
cmbxfd2.RowSource = "Coolant_System"
Case Is = 6
cmbxfd2.RowSource = "Cooling_Loop"
Case Is = 7
cmbxfd2.RowSource = "Electrical"
Case Is = 8
cmbxfd2.RowSource = "Engine_Oil"
Case Is = 9
cmbxfd2.RowSource = "Fuel_System"
Case Is = 10
cmbxfd2.RowSource = "Governor_Spring"
Case Is = 11
cmbxfd2.RowSource = "Guards_And_Brackets"
Case Is = 12
cmbxfd2.RowSource = "Heat_Exchanger"
Case Is = 13
cmbxfd2.RowSource = "Heater"
Case Is = 14
cmbxfd2.RowSource = "Injection_Pump"
Case Is = 15
cmbxfd2.RowSource = "Mag_Pick -Up"
Case Is = 16
cmbxfd2.RowSource = "Piping_Kit"
Case Is = 17
cmbxfd2.RowSource = "Part_Failure"
Case Is = 18
cmbxfd2.RowSource = "Sensor"
Case Is = 19
cmbxfd2.RowSource = "Test_Cell"
Case Is = 20
cmbxfd2.RowSource = "Turbo"
Case Is = 21
cmbxfd2.RowSource = "Wiring_Harness"
End Select
End Sub
Private Sub cmbxfs3_Change()
Dim x As Integer
x = cmbxfs3.ListIndex
Select Case x
Case Is = 0
cmbxfd3.RowSource = "Assembly_Operator"
Case Is = 1
cmbxfd3.RowSource = "Base_Engine"
Case Is = 2
cmbxfd3.RowSource = "Belts_And_Pulleys"
Case Is = 3
cmbxfd3.RowSource = "CAC"
Case Is = 4
cmbxfd3.RowSource = "Control_Panel"
Case Is = 5
cmbxfd3.RowSource = "Coolant_System"
Case Is = 6
cmbxfd3.RowSource = "Cooling_Loop"
Case Is = 7
cmbxfd3.RowSource = "Electrical"
Case Is = 8
cmbxfd3.RowSource = "Engine_Oil"
Case Is = 9
cmbxfd3.RowSource = "Fuel_System"
Case Is = 10
cmbxfd3.RowSource = "Governor_Spring"
Case Is = 11
cmbxfd3.RowSource = "Guards_And_Brackets"
Case Is = 12
cmbxfd3.RowSource = "Heat_Exchanger"
Case Is = 13
cmbxfd3.RowSource = "Heater"
Case Is = 14
cmbxfd3.RowSource = "Injection_Pump"
Case Is = 15
cmbxfd3.RowSource = "Mag_Pick -Up"
Case Is = 16
cmbxfd3.RowSource = "Piping_Kit"
Case Is = 17
cmbxfd3.RowSource = "Part_Failure"
Case Is = 18
cmbxfd3.RowSource = "Sensor"
Case Is = 19
cmbxfd3.RowSource = "Test_Cell"
Case Is = 20
cmbxfd3.RowSource = "Turbo"
Case Is = 21
cmbxfd3.RowSource = "Wiring_Harness"
End Select
End Sub
Private Sub cmbxfs4_Change()
Dim x As Integer
x = cmbxfs4.ListIndex
Select Case x
Case Is = 0
cmbxfd4.RowSource = "Assembly_Operator"
Case Is = 1
cmbxfd4.RowSource = "Base_Engine"
Case Is = 2
cmbxfd4.RowSource = "Belts_And_Pulleys"
Case Is = 3
cmbxfd4.RowSource = "CAC"
Case Is = 4
cmbxfd4.RowSource = "Control_Panel"
Case Is = 5
cmbxfd4.RowSource = "Coolant_System"
Case Is = 6
cmbxfd4.RowSource = "Cooling_Loop"
Case Is = 7
cmbxfd4.RowSource = "Electrical"
Case Is = 8
cmbxfd4.RowSource = "Engine_Oil"
Case Is = 9
cmbxfd4.RowSource = "Fuel_System"
Case Is = 10
cmbxfd4.RowSource = "Governor_Spring"
Case Is = 11
cmbxfd4.RowSource = "Guards_And_Brackets"
Case Is = 12
cmbxfd4.RowSource = "Heat_Exchanger"
Case Is = 13
cmbxfd4.RowSource = "Heater"
Case Is = 14
cmbxfd4.RowSource = "Injection_Pump"
Case Is = 15
cmbxfd4.RowSource = "Mag_Pick -Up"
Case Is = 16
cmbxfd4.RowSource = "Piping_Kit"
Case Is = 17
cmbxfd4.RowSource = "Part_Failure"
Case Is = 18
cmbxfd4.RowSource = "Sensor"
Case Is = 19
cmbxfd4.RowSource = "Test_Cell"
Case Is = 20
cmbxfd4.RowSource = "Turbo"
Case Is = 21
cmbxfd4.RowSource = "Wiring_Harness"
End Select
End Sub
Private Sub cmbxfs5_Change()
Dim x As Integer
x = cmbxfs5.ListIndex
Select Case x
Case Is = 0
cmbxfd5.RowSource = "Assembly_Operator"
Case Is = 1
cmbxfd5.RowSource = "Base_Engine"
Case Is = 2
cmbxfd5.RowSource = "Belts_And_Pulleys"
Case Is = 3
cmbxfd5.RowSource = "CAC"
Case Is = 4
cmbxfd5.RowSource = "Control_Panel"
Case Is = 5
cmbxfd5.RowSource = "Coolant_System"
Case Is = 6
cmbxfd5.RowSource = "Cooling_Loop"
Case Is = 7
cmbxfd5.RowSource = "Electrical"
Case Is = 8
cmbxfd5.RowSource = "Engine_Oil"
Case Is = 9
cmbxfd5.RowSource = "Fuel_System"
Case Is = 10
cmbxfd5.RowSource = "Governor_Spring"
Case Is = 11
cmbxfd5.RowSource = "Guards_And_Brackets"
Case Is = 12
cmbxfd5.RowSource = "Heat_Exchanger"
Case Is = 13
cmbxfd5.RowSource = "Heater"
Case Is = 14
cmbxfd5.RowSource = "Injection_Pump"
Case Is = 15
cmbxfd5.RowSource = "Mag_Pick -Up"
Case Is = 16
cmbxfd5.RowSource = "Piping_Kit"
Case Is = 17
cmbxfd5.RowSource = "Part_Failure"
Case Is = 18
cmbxfd5.RowSource = "Sensor"
Case Is = 19
cmbxfd5.RowSource = "Test_Cell"
Case Is = 20
cmbxfd5.RowSource = "Turbo"
Case Is = 21
cmbxfd5.RowSource = "Wiring_Harness"
End Select
End Sub
Private Sub cmbxfs6_Change()
Dim x As Integer
x = cmbxfs6.ListIndex
Select Case x
Case Is = 0
cmbxfd6.RowSource = "Assembly_Operator"
Case Is = 1
cmbxfd6.RowSource = "Base_Engine"
Case Is = 2
cmbxfd6.RowSource = "Belts_And_Pulleys"
Case Is = 3
cmbxfd6.RowSource = "CAC"
Case Is = 4
cmbxfd6.RowSource = "Control_Panel"
Case Is = 5
cmbxfd6.RowSource = "Coolant_System"
Case Is = 6
cmbxfd6.RowSource = "Cooling_Loop"
Case Is = 7
cmbxfd6.RowSource = "Electrical"
Case Is = 8
cmbxfd6.RowSource = "Engine_Oil"
Case Is = 9
cmbxfd6.RowSource = "Fuel_System"
Case Is = 10
cmbxfd6.RowSource = "Governor_Spring"
Case Is = 11
cmbxfd6.RowSource = "Guards_And_Brackets"
Case Is = 12
cmbxfd6.RowSource = "Heat_Exchanger"
Case Is = 13
cmbxfd6.RowSource = "Heater"
Case Is = 14
cmbxfd6.RowSource = "Injection_Pump"
Case Is = 15
cmbxfd6.RowSource = "Mag_Pick -Up"
Case Is = 16
cmbxfd6.RowSource = "Piping_Kit"
Case Is = 17
cmbxfd6.RowSource = "Part_Failure"
Case Is = 18
cmbxfd6.RowSource = "Sensor"
Case Is = 19
cmbxfd6.RowSource = "Test_Cell"
Case Is = 20
cmbxfd6.RowSource = "Turbo"
Case Is = 21
cmbxfd6.RowSource = "Wiring_Harness"
End Select
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub txtRprcmnt_Change()
End Sub
Private Sub UserForm_Initialize()
txtdte.Value = Format(Date, "mm/dd/yyyy")
cmbbxmodel.List = Array("DP6H-UFAA50", "DP6H-UFAA70", "DP6H-UFAA88", "DQ6H-UFAA50", "DQ6H-UFAA60", "DQ6H-UFAA88", "DQ6H-UFAA98", "DR8H-UFAA40", "DS0H-UFAA60", "DS0H-UFAA68", "DS0H-UFAAN0", "DSOH-UFAA60", "DT2H-UFAA20", "DT2H-UFAA98", "JU4H-UF10", "JU4H-UF12", "JU4H-UF14", "JU4H-UF22", "JU4H-UF24", "JU4H-UF34", "JU4H-UF40", "JU4H-UF50", "JU4H-UF52", "JU4H-UF54", "JU4H-UFAD98", "JU4H-UFADJ2", "JU4H-UFADJ8", "JU4H-UFADP0", "JU4H-UFADR0", "JU4H-UFADW8", "JU4H-UFADY8", "JU4H-UFADY9", "JU4H-UFAEE8", "JU4H-UFAEF2", "JU4H-UFH0", "JU4H-UFH2", "JU4R-UF19", "JU4-UF50", "JU6H", "JU6H-UF30", "JU6H-UF30-P1", "JU6H-UF34", "JU6H-UF52", "JU6H-UF54", "JU6H-UF58", "JU6H-UF60", "JU6H-UF60-P", "JU6H-UF62", "JU6H-UF84", _
"JU6H-UFAA50", "JU6H-UFAARG", "JU6H-UFAAS0", "JU6H-UFAD88", "JU6H-UFAD98", "JU6H-UFADJ0-D", "JU6H-UFADM0", "JU6H-UFADM2", "JU6H-UFADMG", "JU6H-UFADN0", "JU6H-UFADNG", "JU6H-UFADP0-D", "JU6H-UFADP8", "JU6H-UFADR0", "JU6H-UFADR0-D", "JU6H-UFADR8", "JU6H-UFADS0", "JU6H-UFADT0", "JU6H-UFADTO-D", "JU6H-UFADW8", "JU6H-UFADX8", "JU6H-UFD0", "JU6H-UFM0", "JU6H-UFM2", "JU6R-UFAA57", "JU6R-UFAA59", "JW6H-UFAA60", "JW6H-UFAA80", "JW6H-UFAD70", "JW6H-UFAD80", "JW6H-UFADD0-D", "JW6H-UFADF0", "JW6H-UFADJ0", "JW6H-UFADW8", "JX6H-UFAD60", "JX6H-UFAD88", "JX6H-UFADF0", "JX6H-UFADK0-D", "JX6H-UFADP0", "ZE4H-UFAD60", "ZF6H-UFAC60", "ZF6H-UFAC70")
cmbxfs1.RowSource = "FailedSystems"
cmbxfs2.RowSource = "FailedSystems"
cmbxfs3.RowSource = "FailedSystems"
cmbxfs4.RowSource = "FailedSystems"
cmbxfs5.RowSource = "FailedSystems"
cmbxfs6.RowSource = "FailedSystems"
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, _
CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox "Please use the Close Form button!"
End If
End Sub
SECOND CODE
Dim currentrow As Long
' this video helps get us to next
' https://www.youtube.com/watch?v=yLyPe_M1sNc
Private Sub cmbreview_Click()
Application.ScreenUpdating = False
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("DynoRepairData")
Dim df As Worksheet
Set df = Worksheets("DynoFailureReportForm")
ws.Activate
Dim r As Long
Dim c As Long
' Get row and column of activecell
r = currentrow
ActiveSheet.Cells(r + 1, 15).SpecialCells(xlBlanks)(1).Select
iRow = ActiveCell.Row
currentrow = ActiveCell.Row
df.Activate
With ws
Me.txtjo.Value = .Cells(iRow, 1).Value
Me.txtdte.Value = .Cells(iRow, 2).Value
Me.cmbbxmodel.Value = .Cells(iRow, 3).Value
Me.txtsrl.Value = .Cells(iRow, 4).Value
Me.txttchn.Value = .Cells(iRow, 5).Value
Me.txthtvlt.Value = .Cells(iRow, 6).Value
Me.txtwt.Value = .Cells(iRow, 7).Value
Me.cmbxfs1.Value = .Cells(iRow, 8).Value
Me.cmbxfd1.Value = .Cells(iRow, 9).Value
Me.txttimetofix.Value = .Cells(iRow, 10).Value
Me.txtMECABBYPASS.Value = .Cells(iRow, 11).Value
Me.txtRprcmnt.Value = .Cells(iRow, 12).Value
Me.txtfix.Value = .Cells(iRow, 13).Value
Me.txtdynotechinitials.Value = .Cells(iRow, 14).Value
Me.txtleadmaninitials.Value = .Cells(iRow, 15).Value
Me.txtstage.Value = .Cells(iRow, 16).Value
Me.txtop.Value = .Cells(iRow, 17).Value
Me.txtdecptfailure.Value = .Cells(iRow, 18).Value
Me.txtroot.Value = .Cells(iRow, 19).Value
Me.txtsolution.Value = .Cells(iRow, 20).Value
Me.txtvndrname.Value = .Cells(iRow, 21).Value
Me.txtcmptpart.Value = .Cells(iRow, 22).Value
End With
If Trim(Me.txtjo.Value) = "" Then
Me.txtjo.SetFocus
MsgBox "Lucky you no new failures, you're done for the day"
End If
Application.ScreenUpdating = True
End Sub
Private Sub cmbxfs1_Change()
Dim x As Integer
x = cmbxfs1.ListIndex
Select Case x
Case Is = 0
cmbxfd1.RowSource = "Assembly_Operator"
Case Is = 1
cmbxfd1.RowSource = "Base_Engine"
Case Is = 2
cmbxfd1.RowSource = "Belts_And_Pulleys"
Case Is = 3
cmbxfd1.RowSource = "CAC"
Case Is = 4
cmbxfd1.RowSource = "Control_Panel"
Case Is = 5
cmbxfd1.RowSource = "Coolant_System"
Case Is = 6
cmbxfd1.RowSource = "Cooling_Loop"
Case Is = 7
cmbxfd1.RowSource = "Electrical"
Case Is = 8
cmbxfd1.RowSource = "Engine_Oil"
Case Is = 9
cmbxfd1.RowSource = "Fuel_System"
Case Is = 10
cmbxfd1.RowSource = "Governor_Spring"
Case Is = 11
cmbxfd1.RowSource = "Guards_And_Brackets"
Case Is = 12
cmbxfd1.RowSource = "Heat_Exchanger"
Case Is = 13
cmbxfd1.RowSource = "Heater"
Case Is = 14
cmbxfd1.RowSource = "Injection_Pump"
Case Is = 15
cmbxfd1.RowSource = "Mag_Pick -Up"
Case Is = 16
cmbxfd1.RowSource = "Piping_Kit"
Case Is = 17
cmbxfd1.RowSource = "Part_Failure"
Case Is = 18
cmbxfd1.RowSource = "Sensor"
Case Is = 19
cmbxfd1.RowSource = "Test_Cell"
Case Is = 20
cmbxfd1.RowSource = "Turbo"
Case Is = 21
cmbxfd1.RowSource = "Wiring_Harness"
End Select
End Sub
Private Sub cmdnxt_Click()
Application.ScreenUpdating = False
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("DynoRepairData")
Dim df As Worksheet
Set df = Worksheets("DynoFailureReportForm")
ws.Activate
'checks to make sure first failure is pulled
If Me.txtjo.Value = "" Then
MsgBox "Please press the Pull First Failure to Review button"
Exit Sub
End If
iRow = currentrow
' Checks to make sure nothing in the cell has been changed without the leads knowledge
If Me.txtjo.Value = ws.Cells(iRow, 1).Text Then
Else
answer = MsgBox("Are you sure you want to change Job Order #?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 1).Value = Me.txtjo.Value
Else
Exit Sub
End If
End If
If Me.cmbbxmodel.Value = ws.Cells(iRow, 3).Text Then
Else
answer = MsgBox("Are you sure you want to change the Model #?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 3).Value = Me.cmbbxmodel.Value
Else
Exit Sub
End If
End If
If Me.txtsrl.Value = ws.Cells(iRow, 4).Text Then
Else
answer = MsgBox("Are you sure you want to change the Serial #?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 4).Value = Me.txtsrl.Value
Else
Exit Sub
End If
End If
If Me.txttchn.Value = ws.Cells(iRow, 5).Text Then
Else
answer = MsgBox("Are you sure you want to change the Dyno Operators Name?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 5).Value = Me.txttchn.Value
Else
Exit Sub
End If
End If
If Me.txthtvlt.Value = ws.Cells(iRow, 6).Text Then
Else
answer = MsgBox("Are you sure you want to change the Heater Voltage?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 6).Value = Me.txthtvlt.Value
Else
Exit Sub
End If
End If
If Me.txtwt.Value = ws.Cells(iRow, 7).Text Then
Else
answer = MsgBox("Are you sure you want to change the Wattage?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 7).Value = Me.txtwt.Value
Else
Exit Sub
End If
End If
If Me.cmbxfs1.Value = ws.Cells(iRow, 8).Text Then
Else
answer = MsgBox("Are you sure you want to change the failed system?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 8).Value = Me.cmbxfs1.Value
Else
Exit Sub
End If
End If
If Me.cmbxfd1.Value = ws.Cells(iRow, 9).Text Then
Else
answer = MsgBox("Are you sure you want to change the description of the failure?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 9).Value = Me.cmbxfd1.Value
Else
Exit Sub
End If
End If
If Me.txttimetofix.Value = ws.Cells(iRow, 10).Text Then
Else
answer = MsgBox("Are you sure you want to change the time to fix", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 10).Value = Me.txttimetofix.Value
Else
Exit Sub
End If
End If
If Me.txtMECABBYPASS.Value = ws.Cells(iRow, 11).Text Then
Else
answer = MsgBox("Are you sure you want to change if the MECAB bypass worked?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 11).Value = Me.txtMECABBYPASS.Value
Else
Exit Sub
End If
End If
If Me.txtRprcmnt.Value = ws.Cells(iRow, 12).Text Then
Else
answer = MsgBox("Are you sure you want to change the Repairs and Comments section?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 12).Value = Me.txtRprcmnt.Value
Else
Exit Sub
End If
End If
If Me.txtfix.Value = ws.Cells(iRow, 13).Text Then
Else
answer = MsgBox("Are you sure you want to change if the engine could be fixed in the dyno?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 13).Value = Me.txtfix.Value
Else
Exit Sub
End If
End If
If Me.txtleadmaninitials.Value = ws.Cells(iRow, 15).Text Then
Else
answer = MsgBox("Are you sure you want to sign off on this report?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 15).Value = Me.txtleadmaninitials.Value
Else
Exit Sub
End If
End If
If Me.txtstage.Value = ws.Cells(iRow, 16).Text Then
Else
answer = MsgBox("Are you sure you want to change the Stage?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 16).Value = Me.txtstage.Value
Else
Exit Sub
End If
End If
If Me.txtop.Value = ws.Cells(iRow, 17).Text Then
Else
answer = MsgBox("Are you sure you want to change the technican?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 17).Value = Me.txtop.Value
Else
Exit Sub
End If
End If
If Me.txtdecptfailure.Value = ws.Cells(iRow, 18).Text Then
Else
answer = MsgBox("Are you sure you want to change the detailed failure description?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 18).Value = Me.txtdecptfailure.Value
Else
Exit Sub
End If
End If
If Me.txtroot.Value = ws.Cells(iRow, 19).Text Then
Else
answer = MsgBox("Are you sure you want to change the root cause?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 19).Value = Me.txtroot.Value
Else
Exit Sub
End If
End If
If Me.txtsolution.Value = ws.Cells(iRow, 20).Text Then
Else
answer = MsgBox("Are you sure you want to change the initiated solution?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 20).Value = Me.txtsolution.Value
Else
Exit Sub
End If
End If
If Me.txtvndrname.Value = ws.Cells(iRow, 21).Text Then
Else
answer = MsgBox("Are you sure you want to change the vendor?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 21).Value = Me.txtvndrname.Value
Else
Exit Sub
End If
End If
If Me.txtcmptpart.Value = ws.Cells(iRow, 22).Text Then
Else
answer = MsgBox("Are you sure you want to change the component part #?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 22).Value = Me.txtcmptpart.Value
Else
Exit Sub
End If
End If
'this will move 1 row down from the first blank set when pulling the first failure
currentrow = currentrow + 1
' This find the next blank cell in the leadman initials column (O)
Do Until Range("O" & currentrow) = ""
If Range("O" & currentrow) = "" Then
Exit Sub
Else
currentrow = currentrow + 1
End If
Loop
iRow = currentrow
df.Activate
With ws
Me.txtjo.Value = .Cells(iRow, 1).Value
Me.txtdte.Value = .Cells(iRow, 2).Value
Me.cmbbxmodel.Value = .Cells(iRow, 3).Value
Me.txtsrl.Value = .Cells(iRow, 4).Value
Me.txttchn.Value = .Cells(iRow, 5).Value
Me.txthtvlt.Value = .Cells(iRow, 6).Value
Me.txtwt.Value = .Cells(iRow, 7).Value
Me.cmbxfs1.Value = .Cells(iRow, 8).Value
Me.cmbxfd1.Value = .Cells(iRow, 9).Value
Me.txttimetofix.Value = .Cells(iRow, 10).Value
Me.txtMECABBYPASS.Value = .Cells(iRow, 11).Value
Me.txtRprcmnt.Value = .Cells(iRow, 12).Value
Me.txtfix.Value = .Cells(iRow, 13).Value
Me.txtdynotechinitials.Value = .Cells(iRow, 14).Value
Me.txtleadmaninitials.Value = .Cells(iRow, 15).Value
Me.txtstage.Value = .Cells(iRow, 16).Value
Me.txtop.Value = .Cells(iRow, 17).Value
Me.txtdecptfailure.Value = .Cells(iRow, 18).Value
Me.txtroot.Value = .Cells(iRow, 19).Value
Me.txtsolution.Value = .Cells(iRow, 20).Value
Me.txtvndrname.Value = .Cells(iRow, 21).Value
Me.txtcmptpart.Value = .Cells(iRow, 22).Value
End With
If Trim(Me.txtjo.Value) = "" Then
Me.txtjo.SetFocus
MsgBox "Lucky you no new failures, you're done for the day"
End If
Exit Sub
Application.ScreenUpdating = True
End Sub
Private Sub cmbprevious_Click()
Application.ScreenUpdating = False
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("DynoRepairData")
Dim df As Worksheet
Set df = Worksheets("DynoFailureReportForm")
ws.Activate
'checks to make sure first failure is pulled
If Me.txtjo.Value = "" Then
MsgBox "Please press the Pull First Failure to Review button"
Exit Sub
End If
iRow = currentrow
' Checks to make sure nothing in the cell has been changed without the leads knowledge
If Me.txtjo.Value = ws.Cells(iRow, 1).Text Then
Else
answer = MsgBox("Are you sure you want to change Job Order #?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 1).Value = Me.txtjo.Value
Else
Exit Sub
End If
End If
If Me.cmbbxmodel.Value = ws.Cells(iRow, 3).Text Then
Else
answer = MsgBox("Are you sure you want to change the Model #?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 3).Value = Me.cmbbxmodel.Value
Else
Exit Sub
End If
End If
If Me.txtsrl.Value = ws.Cells(iRow, 4).Text Then
Else
answer = MsgBox("Are you sure you want to change the Serial #?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 4).Value = Me.txtsrl.Value
Else
Exit Sub
End If
End If
If Me.txttchn.Value = ws.Cells(iRow, 5).Text Then
Else
answer = MsgBox("Are you sure you want to change the Dyno Operators Name?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 5).Value = Me.txttchn.Value
Else
Exit Sub
End If
End If
If Me.txthtvlt.Value = ws.Cells(iRow, 6).Text Then
Else
answer = MsgBox("Are you sure you want to change the Heater Voltage?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 6).Value = Me.txthtvlt.Value
Else
Exit Sub
End If
End If
If Me.txtwt.Value = ws.Cells(iRow, 7).Text Then
Else
answer = MsgBox("Are you sure you want to change the Wattage?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 7).Value = Me.txtwt.Value
Else
Exit Sub
End If
End If
If Me.cmbxfs1.Value = ws.Cells(iRow, 8).Text Then
Else
answer = MsgBox("Are you sure you want to change the failed system?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 8).Value = Me.cmbxfs1.Value
Else
Exit Sub
End If
End If
If Me.cmbxfd1.Value = ws.Cells(iRow, 9).Text Then
Else
answer = MsgBox("Are you sure you want to change the description of the failure?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 9).Value = Me.cmbxfd1.Value
Else
Exit Sub
End If
End If
If Me.txttimetofix.Value = ws.Cells(iRow, 10).Text Then
Else
answer = MsgBox("Are you sure you want to change the time to fix", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 10).Value = Me.txttimetofix.Value
Else
Exit Sub
End If
End If
If Me.txtMECABBYPASS.Value = ws.Cells(iRow, 11).Text Then
Else
answer = MsgBox("Are you sure you want to change if the MECAB bypass worked?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 11).Value = Me.txtMECABBYPASS.Value
Else
Exit Sub
End If
End If
If Me.txtRprcmnt.Value = ws.Cells(iRow, 12).Text Then
Else
answer = MsgBox("Are you sure you want to change the Repairs and Comments section?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 12).Value = Me.txtRprcmnt.Value
Else
Exit Sub
End If
End If
If Me.txtfix.Value = ws.Cells(iRow, 13).Text Then
Else
answer = MsgBox("Are you sure you want to change if the engine could be fixed in the dyno?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 13).Value = Me.txtfix.Value
Else
Exit Sub
End If
End If
If Me.txtleadmaninitials.Value = ws.Cells(iRow, 15).Text Then
Else
answer = MsgBox("Are you sure you want to sign off on this report?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 15).Value = Me.txtleadmaninitials.Value
Else
Exit Sub
End If
End If
If Me.txtstage.Value = ws.Cells(iRow, 16).Text Then
Else
answer = MsgBox("Are you sure you want to change the Stage?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 16).Value = Me.txtstage.Value
Else
Exit Sub
End If
End If
If Me.txtop.Value = ws.Cells(iRow, 17).Text Then
Else
answer = MsgBox("Are you sure you want to change the technican?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 17).Value = Me.txtop.Value
Else
Exit Sub
End If
End If
If Me.txtdecptfailure.Value = ws.Cells(iRow, 18).Text Then
Else
answer = MsgBox("Are you sure you want to change the detailed failure description?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 18).Value = Me.txtdecptfailure.Value
Else
Exit Sub
End If
End If
If Me.txtroot.Value = ws.Cells(iRow, 19).Text Then
Else
answer = MsgBox("Are you sure you want to change the root cause?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 19).Value = Me.txtroot.Value
Else
Exit Sub
End If
End If
If Me.txtsolution.Value = ws.Cells(iRow, 20).Text Then
Else
answer = MsgBox("Are you sure you want to change the initiated solution?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 20).Value = Me.txtsolution.Value
Else
Exit Sub
End If
End If
If Me.txtvndrname.Value = ws.Cells(iRow, 21).Text Then
Else
answer = MsgBox("Are you sure you want to change the vendor?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 21).Value = Me.txtvndrname.Value
Else
Exit Sub
End If
End If
If Me.txtcmptpart.Value = ws.Cells(iRow, 22).Text Then
Else
answer = MsgBox("Are you sure you want to change the component part #?", vbYesNo, "Change Data")
If answer = vbYes Then
ws.Cells(iRow, 22).Value = Me.txtcmptpart.Value
Else
Exit Sub
End If
End If
'this will move 1 row down from the first blank set when pulling the first failure
currentrow = currentrow - 1
' This find the next blank cell in the leadman initials column (O)
Do Until Range("O" & currentrow) = ""
If Range("O" & currentrow) = "" Then
Exit Sub
Else
If currentrow > 1 Then
currentrow = currentrow - 1
Else
MsgBox "This is the first report to review"
r = currentrow
ActiveSheet.Cells(r + 1, 15).SpecialCells(xlBlanks)(1).Select
iRow = ActiveCell.Row
currentrow = ActiveCell.Row
Exit Sub
End If
End If
Loop
iRow = currentrow
df.Activate
With ws
Me.txtjo.Value = .Cells(iRow, 1).Value
Me.txtdte.Value = .Cells(iRow, 2).Value
Me.cmbbxmodel.Value = .Cells(iRow, 3).Value
Me.txtsrl.Value = .Cells(iRow, 4).Value
Me.txttchn.Value = .Cells(iRow, 5).Value
Me.txthtvlt.Value = .Cells(iRow, 6).Value
Me.txtwt.Value = .Cells(iRow, 7).Value
Me.cmbxfs1.Value = .Cells(iRow, 8).Value
Me.cmbxfd1.Value = .Cells(iRow, 9).Value
Me.txttimetofix.Value = .Cells(iRow, 10).Value
Me.txtMECABBYPASS.Value = .Cells(iRow, 11).Value
Me.txtRprcmnt.Value = .Cells(iRow, 12).Value
Me.txtfix.Value = .Cells(iRow, 13).Value
Me.txtdynotechinitials.Value = .Cells(iRow, 14).Value
Me.txtleadmaninitials.Value = .Cells(iRow, 15).Value
Me.txtstage.Value = .Cells(iRow, 16).Value
Me.txtop.Value = .Cells(iRow, 17).Value
Me.txtdecptfailure.Value = .Cells(iRow, 18).Value
Me.txtroot.Value = .Cells(iRow, 19).Value
Me.txtsolution.Value = .Cells(iRow, 20).Value
Me.txtvndrname.Value = .Cells(iRow, 21).Value
Me.txtcmptpart.Value = .Cells(iRow, 22).Value
End With
If Trim(Me.txtjo.Value) = "" Then
Me.txtjo.SetFocus
MsgBox "Lucky you no new failures, you're done for the day"
End If
Exit Sub
Application.ScreenUpdating = True
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, _
CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox "Please use the Close Form button!"
End If
End Sub
Private Sub UserForm_Initialize()
Application.ScreenUpdating = False
Worksheets("DynoRepairData").Activate
ActiveSheet.Cells(1, 15).Select
Worksheets("DynoFailureReportForm").Activate
cmbbxmodel.List = Array("DP6H-UFAA50", "DP6H-UFAA70", "DP6H-UFAA88", "DQ6H-UFAA50", "DQ6H-UFAA60", "DQ6H-UFAA88", "DQ6H-UFAA98", "DR8H-UFAA40", "DS0H-UFAA60", "DS0H-UFAA68", "DS0H-UFAAN0", "DSOH-UFAA60", "DT2H-UFAA20", "DT2H-UFAA98", "JU4H-UF10", "JU4H-UF12", "JU4H-UF14", "JU4H-UF22", "JU4H-UF24", "JU4H-UF34", "JU4H-UF40", "JU4H-UF50", "JU4H-UF52", "JU4H-UF54", "JU4H-UFAD98", "JU4H-UFADJ2", "JU4H-UFADJ8", "JU4H-UFADP0", "JU4H-UFADR0", "JU4H-UFADW8", "JU4H-UFADY8", "JU4H-UFADY9", "JU4H-UFAEE8", "JU4H-UFAEF2", "JU4H-UFH0", "JU4H-UFH2", "JU4R-UF19", "JU4-UF50", "JU6H", "JU6H-UF30", "JU6H-UF30-P1", "JU6H-UF34", "JU6H-UF52", "JU6H-UF54", "JU6H-UF58", "JU6H-UF60", "JU6H-UF60-P", "JU6H-UF62", "JU6H-UF84", _
"JU6H-UFAA50", "JU6H-UFAARG", "JU6H-UFAAS0", "JU6H-UFAD88", "JU6H-UFAD98", "JU6H-UFADJ0-D", "JU6H-UFADM0", "JU6H-UFADM2", "JU6H-UFADMG", "JU6H-UFADN0", "JU6H-UFADNG", "JU6H-UFADP0-D", "JU6H-UFADP8", "JU6H-UFADR0", "JU6H-UFADR0-D", "JU6H-UFADR8", "JU6H-UFADS0", "JU6H-UFADT0", "JU6H-UFADTO-D", "JU6H-UFADW8", "JU6H-UFADX8", "JU6H-UFD0", "JU6H-UFM0", "JU6H-UFM2", "JU6R-UFAA57", "JU6R-UFAA59", "JW6H-UFAA60", "JW6H-UFAA80", "JW6H-UFAD70", "JW6H-UFAD80", "JW6H-UFADD0-D", "JW6H-UFADF0", "JW6H-UFADJ0", "JW6H-UFADW8", "JX6H-UFAD60", "JX6H-UFAD88", "JX6H-UFADF0", "JX6H-UFADK0-D", "JX6H-UFADP0", "ZE4H-UFAD60", "ZF6H-UFAC60", "ZF6H-UFAC70")
cmbxfs1.RowSource = "FailedSystems"
Application.ScreenUpdating = True
End Sub