Code:
Private Sub btn_update_Click()
If Me.TT_Status = "Open" Or Me.TT_Status = "Pending" Then
DoCmd.Save
MsgBox "TT Updates Succesfully", vbInformation, "Updated Successfully"
End If
If Me.cboPriorityCategory = "Service Affected" And Me.TT_Status = "Closed" Or Me.TT_Status = "Resolved" Then
If IsNull(Me.txtRTF) Then
MsgBox "Please Click on Resolution Time Frame if nothing appears check to see that you have selected the site from the site list. If you have selected the site from the site list and click on Resolution Time Frame and still does not appear please email Jyotesh", vbCritical, "Incomplete details"
ElseIf IsNull(Me.Service_Person) Then
MsgBox "Please Enter the Technician who worked on the fault", vbCritical, "Incomplete details"
ElseIf IsNull(Me.txtVehicle) Then
MsgBox "Please Enter the Vehicle Number", vbCritical, "Incomplete details"
ElseIf IsNull(Me.Cause) Then
MsgBox "Please enter the cause of fault identified by the technician ", vbCritical, "Incomplete details"
ElseIf IsNull(Me.Solution) Then
MsgBox "Please enter the the solution used to fix the fault", vbCritical, "Incomplete details"
ElseIf IsNull(Me.txtRDT) Then
MsgBox "Please Enter the date and time fault was resolved", vbCritical, "Incomplete details"
ElseIf IsNull(Me.Closed_By) Then
MsgBox "Please Enetr Your name In Closed By Field", vbCritical, "Incomplete details"
Else
Me.txtTOD = Diff2Dates("ymdhn", [Date Fault Lodged], txtRDT)
Me.txtDSE = IIf(txtRDT > [txtRTF], Diff2Dates("ymdhn", [txtRTF], txtRDT), "")
Me.txtSS = IIf([txtDSE] = "", "Within SLA", "SLA Exceeded")
Me.Availability = Round((1 - ([txtA] / 525600)) * 100, 6)
DoCmd.Save
MsgBox "TT Updates Succesfully", vbInformation, "Updated Successfully"
End If
End If
If Me.cboPriorityCategory = "Non Service Affected" And Me.TT_Status = "Closed" Or Me.TT_Status = "Resolved" Then
If IsNull(Me.txtRTF) Then
MsgBox "Please Click on Resolution Time Frame if nothing appears check to see that you have selected the site from the site list. If you have selected the site from the site list and click on Resolution Time Frame and still does not appear please email Jyotesh", vbCritical, "Incomplete details"
ElseIf IsNull(Me.Service_Person) Then
MsgBox "Please Enter the Technician who worked on the fault", vbCritical, "Incomplete details"
ElseIf IsNull(Me.txtVehicle) Then
MsgBox "Please Enter the Vehicle Number", vbCritical, "Incomplete details"
ElseIf IsNull(Me.Cause) Then
MsgBox "Please enter the cause of fault identified by the technician ", vbCritical, "Incomplete details"
ElseIf IsNull(Me.Solution) Then
MsgBox "Please enter the the solution used to fix the fault", vbCritical, "Incomplete details"
ElseIf IsNull(Me.txtRDT) Then
MsgBox "Please Enter the date and time fault was resolved", vbCritical, "Incomplete details"
ElseIf IsNull(Me.Closed_By) Then
MsgBox "Please Enetr Your name In Closed By Field", vbCritical, "Incomplete details"
Else
Me.txtTOD = Diff2Dates("ymdhn", [Date Fault Lodged], txtRDT)
Me.txtDSE = ""
Me.txtSS = ""
Me.Availability = ""
DoCmd.Save
MsgBox "TT Updates Succesfully", vbInformation, "Updated Successfully"
End If
End If
End Sub