Public Sub CheckSRU()
Dim sql As String
Dim D23Date As Date
D23Date = [Form_Config subform].[D23 Date]
[Form_MD5InitMapData].[D23 Date] = D23Date
[Form_MD5InitMapData].Refresh
'****************************************************************************************
'**** Check all SRUs in 2413 Not yet recieved
'****************************************************************************************
sql = "SELECT DISTINCTROW [2413].Team, [2413].[Submit Date], [2413].[Rec Date], [2413].Doc, D23.DOC, [2413].Found, D23.LOC, [2413].[Mark For], D23.MarkFor, [2413].NSN, D23.NSN, [2413].QTY, D23.QTY, [2413].Noun, D23.NOMENCLATURE, D23.STAIND, D23.CUR, D23.ISUDAY, D23.AWPDAY, D23.STADAY, D23.DELDAY, D23.EDD, D23.ERC "
sql = sql & "FROM 2413 LEFT JOIN D23 ON [2413].Doc = D23.DOC "
sql = sql & "WHERE ((([2413].Team)='" & [Form_MD5InitMapData]!Name & "') AND (([2413].[Rec Date]) Is Null));"
Me.RecordSource = sql
Do While Not Me.Recordset.EOF
With Me.Recordset
'Not in D23 or D19
If IsNull(.[d23.doc]) Then
If .[Found] Then
If Me.Check8.Value = False Then
WriteBounce .[2413.doc], "Appears to have been received. Please review status.", False, True
Else
WriteBounce .[2413.doc], "Appears to have been received. Updating 2413. Please review status.", False, True
.edit
.[Rec Date] = Date
.Update
End If
Else
If IIf(IsNull(.[Submit Date]), True, .[Submit Date] < D23Date) And Format(Date, "ddd") = "Wed" Then
'Monitor XB3s not tracked in D23 or D19
WriteBounce .[2413.doc], .[NOUN] & " has never been found in D23 or D19. Please review status.", False, True
End If
End If
Else
'********************************
'***** Is in D23 and/or D19 *****
'********************************
If Not .[Found] Then
.edit
.[Found] = True
.Update
End If
'***** Check EDD If Listed *****
If IsNull(.EDD) Then
Dtemp = Date + 1
Else
Dtemp = To_Date(.[EDD])
End If
If Dtemp + 30 < Date Then
WriteBounce .[2413.doc], "D23 lists EDD date:" & Dtemp & " Overdue by " & Date - To_Date(.[EDD]) & " Days. Please review.", False, True
End If
'Check Status
If Not IsNull(.[STAIND]) And .[STAIND] <> "CRT" Then
WriteBounce .[2413.doc], .[NOUN] & " requires a turn in to supply.", True, True
End If
If .[STAIND] = "ISU" Then
WriteBounce .[2413.doc], "Appears to have been received. Updating 2413. Please review status.", False, True
End If
'********Null Status*******
If IsNull(.[STAIND]) Then
If .[ERC] <> "XB3" And .[ERC] <> "XF3" Then
WriteBounce .[2413.doc], "D23 shows Blank Status. Change to appropriate status.", True, True
End If
End If
'******************************************
'*Check Maint Days **
'******************************************
If Not (.[Cur] = "AWI" Or .[Cur] = "AWM" Or .[Cur] = "AWF" Or .[Cur] = "INW" Or .[Cur] = "FWP") Or IsNull(.[Cur]) Then
'ASSUME $WP status
MaintTemp = 0
Else
'Assume AWF status
MaintTemp = IIf(.[STAIND] = "N/C" Or .[STAIND] = "CRT", 0, (Date - D23Date) + .[ISUDAY])
End If
If MaintTemp > 2 And MaintTemp < 45 Then WriteBounce .[d23.doc], .Nomenclature & " has " & MaintTemp & " Repair Days!", True, True
If 60 - MaintTemp < 15 Then 'Getting close to carcass
If MaintTemp < 60 Then
WriteBounce .[d23.doc], .Nomenclature & " is " & 60 - MaintTemp & " DAYS FROM CARCASS! *** NOTIFY " & Form_MD5InitMapData.[POC] & " ***", True, True
Else
WriteBounce .[d23.doc], .Nomenclature & " is " & MaintTemp - 60 & " DAYS CARCASSaasdlkfjhawe! *** NOTIFY " & Form_MD5InitMapData.[POC] & " ***", True, True
End If
End If
'Check NSN
If .[D23.NSN] <> .[2413.nsn] Then
.edit
.[2413.nsn] = .[D23.NSN]
.Update
WriteBounce .[2413.doc], .[NOUN] & " NSN mismatch. repaired with D19 NSN:" & .[D23.NSN] & ".", False, True
End If
'Check Markfor
If Not IsNull(.[Markfor]) And .[Markfor] <> .[Mark For] Then
.edit
.[Mark For] = .[Markfor]
.Update
WriteBounce .[2413.doc], .[NOUN] & " Mark For mismatch. Repaired with D19 Mark For: " & .[Markfor] & ".", False, True
End If
'Check QTY
If .[2413.QTY] <> .[D23.QTY] Then
.edit
.[2413.QTY] = .[D23.QTY]
.Update
WriteBounce .[2413.doc], .[NOUN] & " had wrong QTY: Updated with D23 QTY: " & .[D23.QTY] & ".", False, True
End If
'Check Location
If [Form_MD5InitMapData]!Location <> .[LOC] Then
WriteBounce .[2413.doc], .[NOUN] & " shows D23 location: " & .[LOC] & ".", False, True
End If
End If 'If IsNull(.[d23.doc]) Then
End With
DoEvents: Me.Recordset.MoveNext
Loop
'****************************************************************************************
'**** Check all D23/D19 Entries assigned area, not in 2413, or appear recvd
'****************************************************************************************
sql = "SELECT lru.Abbr, D23.LOC, D23.DOC, [2413].Doc, [2413].[Submit Date], [2413].[Mark For], D23.MarkFor, D23.QTY, [2413].QTY, D23.NSN, [2413].NSN, D23.NOMENCLATURE, [2413].Noun, [2413].Team, [2413].Found, [2413].[Rec Date], D23.STAIND, D23.CUR, D23.ISUDAY, D23.AWPDAY, D23.STADAY, D23.DELDAY, [2413].employee "
sql = sql & "FROM (D23 LEFT JOIN 2413 ON D23.DOC = [2413].Doc) LEFT JOIN lru ON D23.NSN = lru.NSN "
sql = sql & "WHERE (((lru.Abbr) Is Null) AND ((D23.LOC)='" & [Form_MD5InitMapData]!Location & "') AND (Not ([2413].[Rec Date]) Is Null)) OR (((lru.Abbr) Is Null) AND ((D23.LOC)='" & [Form_MD5InitMapData].Recordset.[Location] & "') AND (([2413].Doc) Is Null));"
Me.RecordSource = sql
Do While Not Me.Recordset.EOF
With Me.Recordset
'******************************************
'*Check Maint Days **
'******************************************
If Not (.[Cur] = "AWI" Or .[Cur] = "AWM" Or .[Cur] = "AWF" Or .[Cur] = "INW" Or .[Cur] = "FWP") Or IsNull(.[Cur]) Then
'ASSUME $WP status
MaintTemp = 0
Else
'Assume AWF status
MaintTemp = IIf(.[STAIND] = "N/C" Or .[STAIND] = "CRT", 0, (Date - D23Date) + .[ISUDAY])
End If
If MaintTemp > 2 And MaintTemp < 45 Then WriteBounce .[d23.doc], .Nomenclature & " has " & MaintTemp & " Repair Days!", True, True
If 60 - MaintTemp < 15 Then 'Getting close to carcass
If MaintTemp < 60 Then
WriteBounce .[d23.doc], .Nomenclature & " is " & 60 - MaintTemp & " DAYS FROM CARCASS! *** NOTIFY " & Form_MD5InitMapData.[POC] & " ***", True, True
Else
WriteBounce .[d23.doc], .Nomenclature & " is " & MaintTemp - 60 & " DAYS CARCASS! *** NOTIFY " & Form_MD5InitMapData.[POC] & " ***", True, True
End If
End If
If IsNull(.[2413.doc]) Then
'Needs added to 2413
[Form_MD5Parts SubForm].Recordset.AddNew
[Form_MD5Parts SubForm].Recordset.[Doc] = .[d23.doc]
[Form_MD5Parts SubForm].Recordset.[Submit Date] = Extract(.[d23.doc])
[Form_MD5Parts SubForm].Recordset.[Mark For] = .[Markfor]
[Form_MD5Parts SubForm].Recordset.[QTY] = .[D23.QTY]
[Form_MD5Parts SubForm].Recordset.[NSN] = .[D23.NSN]
[Form_MD5Parts SubForm].Recordset.[NOUN] = .[Nomenclature]
[Form_MD5Parts SubForm].Recordset.[Team] = [Form_MD5InitMapData]!Name
[Form_MD5Parts SubForm].Recordset.[Employee] = "Not Entered"
[Form_MD5Parts SubForm].Recordset.[Found] = True
[Form_MD5Parts SubForm].Recordset.Update
WriteBounce .[d23.doc], "Not in 2413. Adding.", False, True
Else
'Shows recieved in 2413, not so in D23/D19
If .[STAIND] <> "CRT" Then
WriteBounce .[d23.doc], .[NOUN] & " Shows received in 2413, still requires TIN to supply.", True, True
Else
If .[Rec Date] < D23Date Then WriteBounce .[d23.doc], .[NOUN] & " Shows received in 2413, still on order in D23/D19. Please review Status.", False, True
End If
End If
End With
DoEvents: Me.Recordset.MoveNext
Loop
End Sub