Private Sub cmdUpdate_Click()
Dim sSQL, sCondition As String
Dim vROComment As Variant
Call CalculateRanking
If Nz(cboDealerCode) = "" Or Nz(Me.txtASM) = "" Or Nz(Me.fraAssessment) = "" Or Nz(Me.txtRO) = "" Then
MsgBox "Dealer Code, ASM, RO and Assessment needed to save record.", vbCritical
Exit Sub
End If
sCondition = "DealerCode = '" & cboDealerCode & "' AND ASMName = '" & Me.txtASM & "' AND After = " & Me.fraAssessment & " AND RONo = '" & Me.txtRO & "'"
If DCount("*", "tblROMeasurement", sCondition) = 0 Then
MsgBox "Record doesn't exist. Try Creating it before updating it."
End If
vROComment = """" & Replace(Me.txtROComment, "'", "''") & """"
DoCmd.SetWarnings False
sSQL = "UPDATE tblROMeasurement SET " & _
"SpinNo = '" & Me.txtSpinNo & "', " & _
"TypeOfSystem = '" & Me.cboTypeOfSystem & "', " & _
"InvoiceType = '" & Me.cboInvoiceType & "', " & _
"InvoiceAmount = '" & Me.txtInvoiceAmount & "', " & _
"Tenure = '" & Me.cboTenure & "', " & _
"CustNameAddr = " & Me.chkCustNameAddr & ", " & _
"CustPhoneNo = " & Me.chkCustPhoneNo & ", " & _
"VehicleYearModel = " & Me.chkVehicleYearModel & ", " & _
"VIN = " & Me.chkVIN & ", " & _
"MileageIn = " & Me.chkMileageIn & ", " & _
"MileageOut = " & Me.chkMileageOut & ", " & _
"DateIn = " & Me.chkDateIn & ", " & _
"DateOut = " & Me.chkDateIn & ", " & _
"LicensePlateNo = " & Me.chkLicensePlateNo & ", " & _
"ChargeSummary = " & Me.chkChargeSummary & ", " & _
"LineItemChrg = " & Me.chkLineItemChrg & ", "
sSQL = sSQL & _
"CustStatementConcern = " & Me.chkCustStatementConcern & ", " & _
"CauseDesc = " & Me.chkCauseDesc & ", " & _
"RemedyIdentified = " & Me.chkRemedyIdentified & ", " & _
"PartsItemized = " & Me.chkPartsItemized & ", " & _
"ProcDescDiagnRead = " & Me.chkProcDescDiagnRead & ", " & _
"CannotDuplicateDesc = " & Me.chkCannotDuplicateDesc & ", " & _
"NoRepair = " & Me.chkNoRepair & ", " & _
"NoUncommonAcronyms = " & Me.chkNoUncommonAcronyms & ", "
sSQL = sSQL & _
"RegionContacted = " & Me.chkRegionContacted & ", " & _
"GoodwillNotation = " & Me.chkGoodwillNotation & ", " & _
"Points = " & Me.txtScore & ", " & _
"ROComment = " & vROComment & " " & _
"WHERE DealerCode = '" & Me.cboDealerCode & "' " & _
"AND After = " & Me.fraAssessment & " " & _
"AND RONo = '" & Me.txtRO & "' " & _
"AND ASMName = '" & Me.txtASM & "'"
DoCmd.RunSQL sSQL
End Sub