Skip to content

Instantly share code, notes, and snippets.

@aybabtme
Created February 25, 2016 16:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aybabtme/89e1f475c731ae985a1f to your computer and use it in GitHub Desktop.
Save aybabtme/89e1f475c731ae985a1f to your computer and use it in GitHub Desktop.
Private Sub TFKINCOPEN_Change()
Dim CATA, CATB, CATC, CDNMIL, CDNCIV, USMIL, USCIV, ISAFMIL, ISAFCIV, ANA, ANP, ANSF, LN, POIDetainee, Child As String
DB.Cells(2, 2).Value = MainPanel.TFKINCOPEN.Value
RecoverIncident (MainPanel.TFKINCOPEN.Value)
MainPanel.IncISAFDisp.Caption = "ISAF #: " & DB.Range("C2")
MainPanel.IncUnitDisp.Caption = "Unit: " & DB.Range("G2")
MainPanel.IncEnSizeDisp.Caption = "S: " & DB.Range("K2")
MainPanel.IncEnActDisp.Caption = "A: " & DB.Range("L2")
MainPanel.IncTimeDisp.Caption = "T: " & DB.Range("O2")
MainPanel.IncGridDisp.Caption = "L: " & DB.Range("N2")
MainPanel.IncDescrDisp.Caption = "A: " & DB.Range("M2")
If DB.Range("I2") Then MainPanel.IncClosedDisp.Caption = "CLOSED" Else MainPanel.IncClosedDisp.Caption = "ONGOING"
If DB.Range("AF2") <> "" Then
If DB.Range("AI2") <> "" Then CATA = DB.Range("AI2") & " x CAT A "
If DB.Range("AJ2") <> "" Then CATA = DB.Range("AJ2") & " x CAT B "
If DB.Range("AK2") <> "" Then CATA = DB.Range("AK2") & " x CAT C "
MainPanel.IncCasCountDisp.Caption = "Casualties: " & CATA & CATB & CATC
Else
MainPanel.IncCasCountDisp.Caption = "No casualties reported."
End If
If DB.Range("AF2") <> "" Then
If DB.Cells(2, 57) <> "" Then CDNMIL = DB.Cells(2, 57) & " x CDN MIL " Else CDNMIL = ""
If DB.Cells(2, 58) <> "" Then USMIL = DB.Cells(2, 58) & " x US MIL " Else USMIL = ""
If DB.Cells(2, 59) <> "" Then ISAFMIL = DB.Cells(2, 59) & " x ISAF MIL " Else ISAFMIL = ""
If DB.Cells(2, 60) <> "" Then CDNCIV = DB.Cells(2, 60) & " x CDN CIV " Else CDNCIV = ""
If DB.Cells(2, 61) <> "" Then USCIV = DB.Cells(2, 61) & " x US CIV " Else USCIV = ""
If DB.Cells(2, 62) <> "" Then ISAFCIV = DB.Cells(2, 62) & " x ISAF CIV " Else ISAFCIV = ""
If DB.Cells(2, 63) <> "" Then ANA = DB.Cells(2, 63) & " x ANA " Else ANA = ""
If DB.Cells(2, 64) <> "" Then ANP = DB.Cells(2, 64) & " x ANP " Else ANP = ""
If DB.Cells(2, 65) <> "" Then ANSF = DB.Cells(2, 65) & " x ANSF " Else ANSF = ""
If DB.Cells(2, 66) <> "" Then LN = DB.Cells(2, 66) & " x LN " Else LN = ""
If DB.Cells(2, 67) <> "" Then POIDetainee = DB.Cells(2, 67) & " x POI/Detainee " Else POIDetainee = ""
If DB.Cells(2, 68) <> "" Then Child = DB.Cells(2, 68) & " x Child " Else Child = ""
MainPanel.IncCasNatDisp.Caption = "Nationalty: " & CDNMIL & USMIL & ISAFMIL & CDNCIV & USCIV & ISAFCIV & ANA & ANP & ANSF & LN & POIDetainee & Child
Else
MainPanel.IncCasNatDisp.Caption = ""
End If
End Sub
Private Sub TFKINCOPEN_DropButtonClick()
UserForm_Initialize
End Sub
Private Sub UserForm_Click()
Dim strSheetName As String
strSheetName = "Choices" & "!"
MainPanel.TFKINCCREATE.RowSource = strSheetName & Choices.Cells(2, 9)
strSheetName = "DB" & "!"
MainPanel.TFKINCOPEN.RowSource = strSheetName & DB.Cells(1, 2)
MainPanel.TFKINCDELETE.RowSource = strSheetName & DB.Cells(1, 2)
MainPanel.OpenIncident.Value = SearchModule.IncidentOpen
End Sub
Private Sub UserForm_Initialize()
Dim strSheetName As String
strSheetName = "Choices" & "!"
MainPanel.TFKINCCREATE.RowSource = strSheetName & Choices.Cells(2, 9)
strSheetName = "DB" & "!"
MainPanel.TFKINCOPEN.RowSource = strSheetName & DB.Cells(1, 2)
MainPanel.TFKINCDELETE.RowSource = strSheetName & DB.Cells(1, 2)
MainPanel.OpenIncident.Value = SearchModule.IncidentOpen
End Sub
Private Sub TFKINCCREATE_Change()
DB.Cells(2, 2) = MainPanel.TFKINCCREATE.Value
End Sub
Function RecoverIncident(ByVal strTFKIncNumber As String)
Dim i As Integer
Dim n As Integer
For i = 0 To 5000
If DB.Cells(4 + i, 2).Value = strTFKIncNumber Then
For n = 1 To 256
DB.Cells(2, n).Value = DB.Cells(4 + i, n).Value
Next n
Exit For
End If
Next i
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment